Init v3.2
This commit is contained in:
commit
6e70a1d4df
49 files changed
+2115
No files matched your search
+14
@@ -0,0 +1,14 @@
|
||||
.DS_Store
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw*
|
||||
web
|
||||
images
|
||||
cache
|
||||
go_lib
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 xusenlin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,112 @@
|
||||
# Blog
|
||||
|
||||
> Blog 是基于 go 语言开发的,不依赖第三方 go 库,适合用来学习和展示 markdown 文档的精美博客。
|
||||
|
||||
|
||||
:chestnut: [JiXieShi](http://www.starss.cc/) (个人博客,正在使用)
|
||||
---
|
||||
|
||||
## 项目背景
|
||||
博客从最早的静态 Html+Css 主页到 Wordpress 、Typecho 、Hexo 、Hugo 一路尝试过来,虽然他们都是很优秀的开源项目,但是没有一款符合我内心真正的诉求。
|
||||
他们有的要么太重了要么部署不方便要么对存储的文章不友好,我就放弃了之前在Typecho上的文章,同时调整分类也不那么灵活,有的迁移也不方便。
|
||||
自己太懒,不想自己做文章备份,不想安装数据库,快速响应也是必须的,所以才有了用 GOLANG 来写一个简单博客的想法。
|
||||
当然,自己的这个项目并不能和这些优秀的开源项目相比较,它只是符合我自己的诉求顺便用来学习GOLANG的项目。(写文章也能增加github的活跃度,逃 :))
|
||||
|
||||
## Blog 在做什么
|
||||
|
||||
|
||||
简单来说,Blog 会使用 git 将你的 .md 文档仓库克隆到当前目录下, 然后并行加载和解析文章关键信息并生成内容,呈现一个博客站点。
|
||||
当你向你的 git 仓库提交文章的时候,你可以设置 webHooks 来自动通知 Blog 更新同步文章,或者可以在仪表盘里手动更新文章。
|
||||
|
||||
|
||||
## 安装
|
||||
你可以克隆当前仓库,然后在 JSON 文件里面配置好你文档的 Git 地址和 WebHook 秘钥,编译源代码并放入后台运行。
|
||||
|
||||
|
||||
## 使用
|
||||
|
||||
- 配置好 config.json 文件,详细的配置说明文件在当前仓库根目录的《配置说明.md》
|
||||
- 新建一个 git 仓库,用来存放你的文章,但是对你的目录结构有一些要求
|
||||
如下:
|
||||
```
|
||||
|-- assets //博客静态文件,存放一些图片资源,方便显示到文档里
|
||||
|-- content
|
||||
| |-- GOLANG //分类目录
|
||||
| |-- GOLANG基础 // 子分类目录,但是在页面上不会产生分类目录
|
||||
| |--- GOLANG基础语法.md
|
||||
| |-- 其他分类
|
||||
| |--- xxx.md
|
||||
|-- extra_nav // Blog只会有 Blog Categories 两个导航,其他导航可以放到这个目录下,比如自己的简历,作品之类的
|
||||
|
||||
```
|
||||
content目录下的一级目录代表一个分类,如果一级目录下有子级目录也不会产生新的分类,子级目录的文档也会属于一级目录的分类。
|
||||
|
||||
- 每一篇文章的开头可以配置一些文章的属性,具体可以看 配置说明.md
|
||||
如下:
|
||||
```
|
||||
```json
|
||||
{
|
||||
"date":"2019.01.02 14:33",//最少需要
|
||||
"tags": ["BLOG","其它tag"],//可以不填,不过最好添加一些tag,后面可以做一些好玩的东西。
|
||||
"title": "文章的标题,一般不用填写,默认使用文件名",
|
||||
"description": "文章描述,不填写自动取正文200个字,可以在app.json中配置",
|
||||
"author": "JiXieShi", //文章作者,可以不用填写,现在也没有使用到
|
||||
"musicId":"网易云歌单ID" //文章的配歌
|
||||
}
|
||||
```
|
||||
```
|
||||
我会根据关键字```json来解析,不用担心这个会显示到文章内容里面,我在解析的时候就将它去掉了。
|
||||
如果不再文章前面添加这一段json也是可以的,不过我不建议这么做,因为这样就和V1.0版本没什么区别了,没有了文章属性,排序都是个问题。
|
||||
最后,mac markdown 文章编辑器推荐 Typora。
|
||||
|
||||
> 提示:```json 前面不能有其它字符。
|
||||
|
||||
- 切换主题色和搜索文章在仪表盘里,访问/admin 可以查看仪表盘,
|
||||
如果不想让别人知道你的仪表盘地址可以自己配置dashboard字段。
|
||||
|
||||
|
||||
## TODO
|
||||
- [x] 1.移动端更好的适配
|
||||
- [x] 2.根目录可以添加其他文件生成导航
|
||||
- [x] 3.仪表盘支持切换主题色
|
||||
- [x] 4.仪表盘支持搜索
|
||||
- [x] 5.tags的展示
|
||||
- [x] 6.仪表盘添加手动更新文章功能
|
||||
- [x] 7.添加webHook支持(去掉自动更新)
|
||||
- [x] 8.添加评论支持(在配置里开启,所有评论都会储存在仓库的Issues)
|
||||
- [x] 9.支持网易云音乐
|
||||
- [x] 10.支持自定义切换主题
|
||||
|
||||
> 后续尽善尽美之后,我可能会提供其他漂亮的主题皮肤,也欢迎大家参与进来。
|
||||
|
||||
## 特性
|
||||
|
||||
1. 响应迅速 ---没有什么依赖,得益于GOLANG的运行速度,部署在阿里云的博客平均响应在50毫秒内。
|
||||
2. 迁移方便 ---GOLANG交叉编译可以方便的发布二进制文件到不同的操作系统,执行二进制文件并克隆博客文件即可运行你的博客。
|
||||
3. 小巧精美 ---非常简单的代码方便学习和改造,即使有一天你厌倦Blog,你的文章也能很好的迁移和阅读。
|
||||
4. 分类调整 ---随时调整你的文章分类,你可以把一个文件夹里所有的东西移动到其他分类里的某个地方,不管有多少层级,分类发生了什么翻天覆地的变化,下一次更新就能展示。
|
||||
|
||||
## 更新日志
|
||||
|
||||
### V3.2
|
||||
* 加入Tag搜索和展示
|
||||
|
||||
### V3.1
|
||||
* 去掉标题的.MD后缀
|
||||
* 网易云音乐改为左下悬浮,同时由音乐id改为歌单id
|
||||
* 增加主题配置项(ps:虽然只有一个简单主题)
|
||||
|
||||
### V3.0
|
||||
* 完全重构,添加了短链,美化了 URL
|
||||
* 自动完成克隆工作
|
||||
* 添加了网易云音乐功能
|
||||
* 文件自动生成导航(导航排序通过时间可自定义)
|
||||
|
||||
|
||||
|
||||
|
||||
## 感谢
|
||||
|
||||
## License
|
||||
|
||||
MIT © Richard McRichface
|
||||
@@ -0,0 +1,26 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"blog/config"
|
||||
"blog/models"
|
||||
"blog/routes"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func init() {
|
||||
models.CompiledContent() //克隆或者更新文章、递归生成文章、导航、短链 Map、加载模板
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
routes.InitRoute()
|
||||
fmt.Printf("Version:v%v \n", config.Cfg.Version)
|
||||
fmt.Printf("ListenAndServe On Port %v \n", config.Cfg.Port)
|
||||
fmt.Printf("Dashboard On Path %v \n", config.Cfg.Dashboard)
|
||||
fmt.Printf("UpdateArticle's GitHookUrl: %v Secret: %v \n", config.Cfg.GitHookUrl, config.Cfg.WebHookSecret)
|
||||
if err := http.ListenAndServe(":"+strconv.Itoa(config.Cfg.Port), nil); err != nil {
|
||||
fmt.Println("ServeErr:", err)
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"port": 8080,
|
||||
"pageSize": 3,
|
||||
"descriptionLen": 200,
|
||||
"author": "JiXieShi",
|
||||
"icp": "",
|
||||
"webHookSecret": "jixieshi",
|
||||
"categoryDisplayQuantity": 6,
|
||||
"utterancesRepo": "jixishi/blog_docs",
|
||||
"timeLayout": "2006.01.02 15:04",
|
||||
"siteName": "JiXieShi's Blog",
|
||||
"htmlKeywords": "forest blog,Golang,ARM,BE6,前端,硬件",
|
||||
"htmlDescription": "JiXieShi's Personal blog",
|
||||
"documentGitUrl": "https://github.com/jixishi/blog_docs.git",
|
||||
"themePath": "/blog",
|
||||
"themeColor": "#2196f3",
|
||||
"dashboard": "adminjxs",
|
||||
"themeOption": ["#673ab7","#f44336","#9c27b0","#2196f3","#607d8b","#795548"]
|
||||
}
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"blog/utils"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
userConfig
|
||||
systemConfig
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
var Cfg Config
|
||||
|
||||
func init() {
|
||||
var err error
|
||||
|
||||
Cfg.CurrentDir, err = os.Getwd()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
configFile, err := ioutil.ReadFile(Cfg.CurrentDir + "/config.json")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
err = json.Unmarshal(configFile, &Cfg)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if "" == Cfg.Dashboard ||
|
||||
!strings.HasPrefix(Cfg.Dashboard, "/") {
|
||||
Cfg.Dashboard = "/admin"
|
||||
}
|
||||
if "" == Cfg.ThemePath ||
|
||||
!strings.HasPrefix(Cfg.ThemePath, "/") {
|
||||
Cfg.ThemesDir = Cfg.CurrentDir + "/themes/blog" //+ Cfg.ThemePath
|
||||
} else {
|
||||
Cfg.ThemesDir = Cfg.CurrentDir + "/themes" + Cfg.ThemePath
|
||||
}
|
||||
repoName, err := utils.GetRepoName(Cfg.DocumentGitUrl)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
Cfg.AppName = "WebServer"
|
||||
Cfg.Version = 3.2
|
||||
Cfg.DocumentDir = Cfg.CurrentDir + "/" + repoName
|
||||
Cfg.GitHookUrl = "/api/git_push_hook"
|
||||
Cfg.AppRepository = "https://gitea.starss.cc/JiXieShi/Blog"
|
||||
}
|
||||
|
||||
func Initial() {
|
||||
if _, err := exec.LookPath("git"); err != nil {
|
||||
fmt.Println("请先安装git")
|
||||
panic(err)
|
||||
}
|
||||
if !utils.IsDir(Cfg.DocumentDir) {
|
||||
fmt.Println("正在克隆文档仓库,请稍等...")
|
||||
out, err := utils.RunCmdByDir(Cfg.CurrentDir, "git", "clone", Cfg.DocumentGitUrl)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println(out)
|
||||
} else {
|
||||
out, err := utils.RunCmdByDir(Cfg.DocumentDir, "git", "pull")
|
||||
fmt.Println(out)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
}
|
||||
if err := checkDocDirAndBindConfig(&Cfg); err != nil {
|
||||
fmt.Println("文档缺少必要的目录")
|
||||
panic(err)
|
||||
}
|
||||
|
||||
imgDir := Cfg.CurrentDir + "/images"
|
||||
if !utils.IsDir(imgDir) {
|
||||
if os.Mkdir(imgDir, os.ModePerm) != nil {
|
||||
panic("生成images目录失败!")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func checkDocDirAndBindConfig(cfg *Config) error {
|
||||
dirs := []string{"assets", "content", "extra_nav"}
|
||||
for _, dir := range dirs {
|
||||
absoluteDir := Cfg.DocumentDir + "/" + dir
|
||||
if !utils.IsDir(absoluteDir) {
|
||||
return errors.New("documents cannot lack " + absoluteDir + " dir")
|
||||
}
|
||||
}
|
||||
cfg.DocumentAssetsDir = cfg.DocumentDir + "/assets"
|
||||
cfg.DocumentContentDir = cfg.DocumentDir + "/content"
|
||||
cfg.DocumentExtraNavDir = cfg.DocumentDir + "/extra_nav"
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package config
|
||||
|
||||
type systemConfig struct {
|
||||
AppName string
|
||||
Version float32
|
||||
CurrentDir string
|
||||
ThemesDir string
|
||||
GitHookUrl string
|
||||
AppRepository string
|
||||
DocumentDir string
|
||||
DocumentAssetsDir string
|
||||
DocumentContentDir string
|
||||
DocumentExtraNavDir string
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package config
|
||||
|
||||
type userConfig struct {
|
||||
SiteName string `json:"siteName"`
|
||||
|
||||
Author string `json:"author"`
|
||||
|
||||
Icp string `json:"icp"`
|
||||
|
||||
TimeLayout string `json:"timeLayout"`
|
||||
|
||||
Port int `json:"port"`
|
||||
|
||||
WebHookSecret string `json:"webHookSecret"`
|
||||
|
||||
CategoryDisplayQuantity int `json:"categoryDisplayQuantity"`
|
||||
|
||||
UtterancesRepo string `json:"utterancesRepo"`
|
||||
|
||||
PageSize int `json:"pageSize"`
|
||||
|
||||
DescriptionLen int `json:"descriptionLen"`
|
||||
|
||||
DocumentGitUrl string `json:"documentGitUrl"`
|
||||
|
||||
HtmlKeywords string `json:"htmlKeywords"`
|
||||
|
||||
HtmlDescription string `json:"htmlDescription"`
|
||||
|
||||
ThemePath string `json:"themePath"`
|
||||
|
||||
ThemeColor string `json:"themeColor"`
|
||||
|
||||
ThemeOption []string `json:"themeOption"`
|
||||
|
||||
Dashboard string `json:"dashboard"`
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"blog/models"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func Article(w http.ResponseWriter, r *http.Request) {
|
||||
articleTemplate := models.Template.Article
|
||||
|
||||
if err := r.ParseForm(); err != nil {
|
||||
articleTemplate.WriteError(w, err)
|
||||
}
|
||||
key := r.Form.Get("key")
|
||||
|
||||
path := models.ArticleShortUrlMap[key]
|
||||
|
||||
articleDetail, err := models.ReadArticleDetail(path)
|
||||
|
||||
if err != nil {
|
||||
articleTemplate.WriteError(w, err)
|
||||
}
|
||||
|
||||
articleTemplate.WriteData(w, models.BuildViewData("Article", articleDetail))
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"blog/config"
|
||||
"blog/models"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func Category(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
categoriesTemplate := models.Template.Categories
|
||||
|
||||
result := models.GroupByCategory(&models.ArticleList, config.Cfg.CategoryDisplayQuantity)
|
||||
|
||||
categoriesTemplate.WriteData(w, models.BuildViewData("Categories", result))
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"blog/config"
|
||||
"blog/models"
|
||||
"net/http"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func Dashboard(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
var dashboardMsg []string
|
||||
dashboardTemplate := models.Template.Dashboard
|
||||
|
||||
if err := r.ParseForm(); err != nil {
|
||||
dashboardTemplate.WriteError(w, err)
|
||||
}
|
||||
|
||||
index, err := strconv.Atoi(r.Form.Get("theme"))
|
||||
if err == nil && index < len(config.Cfg.ThemeOption) {
|
||||
config.Cfg.ThemeColor = config.Cfg.ThemeOption[index]
|
||||
dashboardMsg = append(dashboardMsg, "颜色切换成功!")
|
||||
}
|
||||
|
||||
action := r.Form.Get("action")
|
||||
if "updateArticle" == action {
|
||||
models.CompiledContent()
|
||||
dashboardMsg = append(dashboardMsg, "文章更新成功!")
|
||||
}
|
||||
|
||||
dashboardTemplate.WriteData(w, models.BuildViewData("Dashboard", map[string]interface{}{
|
||||
"msg": dashboardMsg,
|
||||
}))
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"blog/models"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func ExtraNav(w http.ResponseWriter, r *http.Request) {
|
||||
extraNavTemplate := models.Template.ExtraNav
|
||||
|
||||
if err := r.ParseForm(); err != nil {
|
||||
extraNavTemplate.WriteError(w, err)
|
||||
}
|
||||
|
||||
name := r.Form.Get("name")
|
||||
for _, nav := range models.Navigation {
|
||||
if nav.Title == name {
|
||||
articleDetail, err := models.ReadArticleDetail(nav.Path)
|
||||
if err != nil {
|
||||
extraNavTemplate.WriteError(w, err)
|
||||
}
|
||||
extraNavTemplate.WriteData(w, models.BuildViewData(nav.Title, articleDetail))
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"blog/config"
|
||||
"blog/models"
|
||||
"net/http"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func Index(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
indexTemplate := models.Template.Index
|
||||
|
||||
if err := r.ParseForm(); err != nil {
|
||||
indexTemplate.WriteError(w, err)
|
||||
}
|
||||
|
||||
page, err := strconv.Atoi(r.Form.Get("page"))
|
||||
if err != nil {
|
||||
page = 1
|
||||
}
|
||||
articles := models.ArticleList
|
||||
|
||||
search := r.Form.Get("search")
|
||||
category := r.Form.Get("category")
|
||||
tag := r.Form.Get("tag")
|
||||
|
||||
if search != "" || category != "" || tag != "" {
|
||||
articles = models.ArticleSearch(&articles, search, category, tag)
|
||||
}
|
||||
|
||||
result := models.Pagination(&articles, page, config.Cfg.PageSize)
|
||||
|
||||
indexTemplate.WriteData(w, models.BuildViewData("Blog", result))
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"blog/models"
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func GithubHook(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
//err := r.ParseForm()
|
||||
//if err != nil {
|
||||
// SedResponse(w, err.Error())
|
||||
// return
|
||||
//}
|
||||
//
|
||||
//if "" == config.Cfg.WebHookSecret || "push" != r.Header.Get("x-github-event") {
|
||||
// SedResponse(w, "No Configuration WebHookSecret Or Not Pushing Events")
|
||||
// log.Println("No Configuration WebHookSecret Or Not Pushing Events")
|
||||
// return
|
||||
//}
|
||||
//
|
||||
//sign := r.Header.Get("X-Hub-Signature")
|
||||
//
|
||||
//bodyContent, err := ioutil.ReadAll(r.Body)
|
||||
//
|
||||
//if err != nil {
|
||||
// SedResponse(w, err.Error())
|
||||
// log.Println("WebHook err:" + err.Error())
|
||||
// return
|
||||
//}
|
||||
//
|
||||
//if err = r.Body.Close(); err != nil {
|
||||
// SedResponse(w, err.Error())
|
||||
// log.Println("WebHook err:" + err.Error())
|
||||
// return
|
||||
//}
|
||||
//
|
||||
//mac := hmac.New(sha1.New, []byte(config.Cfg.WebHookSecret))
|
||||
//mac.Write(bodyContent)
|
||||
//expectedHash := "sha1=" + hex.EncodeToString(mac.Sum(nil))
|
||||
//
|
||||
//if sign != expectedHash {
|
||||
// SedResponse(w, "WebHook err:Signature does not match")
|
||||
// log.Println("WebHook err:Signature does not match")
|
||||
// return
|
||||
//}
|
||||
|
||||
SedResponse(w, "ok")
|
||||
|
||||
models.CompiledContent()
|
||||
}
|
||||
|
||||
func SedResponse(w http.ResponseWriter, msg string) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
_, err := w.Write([]byte(`{"msg": "` + msg + `"}`))
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I=
|
||||
github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c=
|
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
@@ -0,0 +1,238 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"blog/config"
|
||||
"blog/utils"
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Time time.Time
|
||||
|
||||
type Article struct {
|
||||
Title string `json:"title"`
|
||||
Date Time `json:"date"`
|
||||
Description string `json:"description"`
|
||||
Tags []string `json:"tags"`
|
||||
Author string `json:"author"`
|
||||
MusicId string `json:"musicId"`
|
||||
Path string
|
||||
ShortUrl string
|
||||
Category string
|
||||
}
|
||||
|
||||
type Articles []Article
|
||||
|
||||
type ArticleDetail struct {
|
||||
Article
|
||||
Body string
|
||||
}
|
||||
|
||||
func initArticlesAndImages(dir string) (Articles, map[string]string, error) {
|
||||
var articles Articles
|
||||
shortUrlMap := make(map[string]string)
|
||||
|
||||
articles, err := RecursiveReadArticles(dir)
|
||||
if err != nil {
|
||||
return articles, shortUrlMap, err
|
||||
}
|
||||
sort.Sort(articles)
|
||||
for i := len(articles) - 1; i >= 0; i-- {
|
||||
//这里必须使用倒序的方式生成 shortUrl,因为如果有相同的文章标题,
|
||||
// 倒序会将最老的文章优先生成shortUrl,保证和之前的 shortUrl一样
|
||||
article := articles[i]
|
||||
keyword := utils.GenerateShortUrl(article.Title, func(url, keyword string) bool {
|
||||
//保证 keyword 唯一
|
||||
_, ok := shortUrlMap[keyword]
|
||||
return !ok
|
||||
})
|
||||
articles[i].ShortUrl = keyword
|
||||
shortUrlMap[keyword] = article.Path
|
||||
}
|
||||
return articles, shortUrlMap, nil
|
||||
}
|
||||
|
||||
func ArticleSearch(articles *Articles, search string, category string, tag string) Articles {
|
||||
|
||||
var articleList Articles
|
||||
for _, article := range *articles {
|
||||
|
||||
pass := true
|
||||
|
||||
if search != "" && strings.Index(article.Title, search) == -1 {
|
||||
pass = false
|
||||
}
|
||||
if category != "" && strings.Index(article.Category, category) == -1 {
|
||||
pass = false
|
||||
}
|
||||
if tag != "" {
|
||||
pass = false
|
||||
for _, tagx := range article.Tags {
|
||||
if strings.Index(tagx, tag) != -1 {
|
||||
pass = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if pass {
|
||||
articleList = append(articleList, article)
|
||||
}
|
||||
|
||||
}
|
||||
return articleList
|
||||
}
|
||||
|
||||
func RecursiveReadArticles(dir string) (Articles, error) {
|
||||
|
||||
var articles Articles
|
||||
|
||||
dirInfo, err := os.Stat(dir)
|
||||
|
||||
if err != nil {
|
||||
return articles, err
|
||||
}
|
||||
if !dirInfo.IsDir() {
|
||||
return articles, errors.New("目标不是一个目录")
|
||||
}
|
||||
|
||||
fileOrDir, err := ioutil.ReadDir(dir)
|
||||
if err != nil {
|
||||
return articles, err
|
||||
}
|
||||
|
||||
for _, fileInfo := range fileOrDir {
|
||||
name := fileInfo.Name()
|
||||
path := dir + "/" + name
|
||||
upperName := strings.ToUpper(name)
|
||||
if fileInfo.IsDir() {
|
||||
subArticles, err := RecursiveReadArticles(path)
|
||||
if err != nil {
|
||||
return articles, err
|
||||
}
|
||||
articles = append(articles, subArticles...)
|
||||
} else if strings.HasSuffix(upperName, ".MD") {
|
||||
article, err := ReadArticle(path)
|
||||
if err != nil {
|
||||
return articles, err
|
||||
}
|
||||
articles = append(articles, article)
|
||||
} else if strings.HasSuffix(upperName, ".PNG") ||
|
||||
strings.HasSuffix(upperName, ".GIF") ||
|
||||
strings.HasSuffix(upperName, ".JPG") {
|
||||
|
||||
dst := config.Cfg.CurrentDir + "/images/" + name
|
||||
fmt.Println(utils.IsFile(dst))
|
||||
if !utils.IsFile(dst) {
|
||||
_, _ = utils.CopyFile(path, dst)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return articles, nil
|
||||
}
|
||||
|
||||
func ReadArticle(path string) (Article, error) {
|
||||
article, _, err := readMarkdown(path)
|
||||
if err != nil {
|
||||
return article, err
|
||||
}
|
||||
return article, nil
|
||||
}
|
||||
|
||||
func ReadArticleDetail(path string) (ArticleDetail, error) {
|
||||
_, articleDetail, err := readMarkdown(path)
|
||||
if err != nil {
|
||||
return articleDetail, err
|
||||
}
|
||||
return articleDetail, nil
|
||||
}
|
||||
|
||||
func readMarkdown(path string) (Article, ArticleDetail, error) {
|
||||
var article Article
|
||||
var articleDetail ArticleDetail
|
||||
mdFile, err := os.Stat(path)
|
||||
|
||||
if err != nil {
|
||||
return article, articleDetail, err
|
||||
}
|
||||
if mdFile.IsDir() {
|
||||
return article, articleDetail, errors.New("this path is Dir")
|
||||
}
|
||||
markdown, err := ioutil.ReadFile(path)
|
||||
|
||||
if err != nil {
|
||||
return article, articleDetail, err
|
||||
}
|
||||
markdown = bytes.TrimSpace(markdown)
|
||||
|
||||
article.Path = path
|
||||
article.Category = GetCategoryName(path)
|
||||
article.Title = strings.TrimSuffix(strings.ToUpper(mdFile.Name()), ".MD")
|
||||
article.Date = Time(mdFile.ModTime())
|
||||
|
||||
if !bytes.HasPrefix(markdown, []byte("```json")) {
|
||||
article.Description = cropDesc(markdown)
|
||||
articleDetail.Article = article
|
||||
articleDetail.Body = string(markdown)
|
||||
return article, articleDetail, nil
|
||||
}
|
||||
|
||||
markdown = bytes.Replace(markdown, []byte("```json"), []byte(""), 1)
|
||||
markdownArrInfo := bytes.SplitN(markdown, []byte("```"), 2)
|
||||
|
||||
article.Description = cropDesc(markdownArrInfo[1])
|
||||
|
||||
if err := json.Unmarshal(bytes.TrimSpace(markdownArrInfo[0]), &article); err != nil {
|
||||
article.Title = "文章[" + article.Title + "]解析 JSON 出错,请检查。"
|
||||
article.Description = err.Error()
|
||||
return article, articleDetail, nil
|
||||
}
|
||||
article.Path = path
|
||||
article.Title = strings.ToUpper(article.Title)
|
||||
|
||||
articleDetail.Article = article
|
||||
articleDetail.Body = string(markdownArrInfo[1])
|
||||
return article, articleDetail, nil
|
||||
}
|
||||
|
||||
func cropDesc(c []byte) string {
|
||||
content := []rune(string(c))
|
||||
contentLen := len(content)
|
||||
|
||||
if contentLen <= config.Cfg.DescriptionLen {
|
||||
return string(content[0:contentLen])
|
||||
}
|
||||
|
||||
return string(content[0:config.Cfg.DescriptionLen])
|
||||
}
|
||||
|
||||
func (t *Time) UnmarshalJSON(b []byte) error {
|
||||
date, err := time.ParseInLocation(`"`+config.Cfg.TimeLayout+`"`, string(b), time.Local)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
*t = Time(date)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t Time) MarshalJSON() ([]byte, error) {
|
||||
|
||||
return []byte(t.Format(`"` + config.Cfg.TimeLayout + `"`)), nil
|
||||
}
|
||||
|
||||
func (t Time) Format(layout string) string {
|
||||
return time.Time(t).Format(layout)
|
||||
}
|
||||
|
||||
func (a Articles) Len() int { return len(a) }
|
||||
|
||||
func (a Articles) Less(i, j int) bool { return time.Time(a[i].Date).After(time.Time(a[j].Date)) }
|
||||
|
||||
func (a Articles) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||
@@ -0,0 +1,69 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"blog/config"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Category struct {
|
||||
Name string
|
||||
Quantity int
|
||||
Articles Articles
|
||||
}
|
||||
type Categories []Category
|
||||
|
||||
func GetCategoryName(path string) string {
|
||||
var categoryName string
|
||||
newPath := strings.Replace(path, config.Cfg.DocumentContentDir+"/", "", 1)
|
||||
|
||||
if strings.Index(newPath, "/") == -1 { //文件在根目录下(content/)没有分类名称
|
||||
categoryName = "未分类"
|
||||
} else {
|
||||
categoryName = strings.Split(newPath, "/")[0]
|
||||
}
|
||||
return categoryName
|
||||
}
|
||||
|
||||
func GroupByCategory(articles *Articles, articleQuantity int) Categories {
|
||||
|
||||
var categories Categories
|
||||
categoryMap := make(map[string]Articles)
|
||||
|
||||
for _, article := range *articles {
|
||||
|
||||
_, existedCategory := categoryMap[article.Category]
|
||||
if existedCategory {
|
||||
categoryMap[article.Category] = append(categoryMap[article.Category], article)
|
||||
} else {
|
||||
categoryMap[article.Category] = Articles{article}
|
||||
}
|
||||
}
|
||||
for categoryName, articles := range categoryMap {
|
||||
articleLen := len(articles)
|
||||
|
||||
var articleList Articles
|
||||
if articleQuantity <= 0 {
|
||||
articleList = articles
|
||||
} else {
|
||||
if articleQuantity > articleLen {
|
||||
articleList = articles[0:articleLen]
|
||||
} else {
|
||||
articleList = articles[0:articleQuantity]
|
||||
}
|
||||
}
|
||||
categories = append(categories, Category{
|
||||
Name: categoryName,
|
||||
Quantity: articleLen,
|
||||
Articles: articleList,
|
||||
})
|
||||
}
|
||||
sort.Sort(categories)
|
||||
return categories
|
||||
}
|
||||
|
||||
func (c Categories) Len() int { return len(c) }
|
||||
|
||||
func (c Categories) Less(i, j int) bool { return c[i].Quantity > c[j].Quantity }
|
||||
|
||||
func (c Categories) Swap(i, j int) { c[i], c[j] = c[j], c[i] }
|
||||
@@ -0,0 +1,50 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"blog/config"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var Navigation Navs
|
||||
var ArticleList Articles
|
||||
var ArticleShortUrlMap map[string]string //用来保证文章 shortUrl 唯一和快速定位文章
|
||||
var Template HtmlTemplate
|
||||
|
||||
func CompiledContent() {
|
||||
config.Initial() //克隆或者更新文档库
|
||||
//下面是对内容的生成
|
||||
wg := sync.WaitGroup{}
|
||||
var err error
|
||||
//导航
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
Navigation, err = initExtraNav(config.Cfg.DocumentExtraNavDir)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
wg.Done()
|
||||
}()
|
||||
|
||||
//加载html模板
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
Template, err = initHtmlTemplate(config.Cfg.ThemesDir)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
wg.Done()
|
||||
}()
|
||||
|
||||
//文章
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
ArticleList, ArticleShortUrlMap, err = initArticlesAndImages(config.Cfg.DocumentContentDir)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
wg.Done()
|
||||
}()
|
||||
wg.Wait()
|
||||
//启用并发比之前节约4倍左右的时间
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Nav struct {
|
||||
Title string
|
||||
Path string
|
||||
}
|
||||
type Navs []Nav
|
||||
|
||||
func initExtraNav(dir string) (Navs, error) {
|
||||
|
||||
var navigation Navs
|
||||
var extraNav Articles
|
||||
|
||||
extraNav, err := RecursiveReadArticles(dir)
|
||||
if err != nil {
|
||||
return navigation, err
|
||||
}
|
||||
sort.Sort(extraNav)
|
||||
|
||||
for _, article := range extraNav {
|
||||
title := strings.Title(strings.ToLower(article.Title))
|
||||
navigation = append(navigation, Nav{Title: title, Path: article.Path})
|
||||
}
|
||||
|
||||
return navigation, nil
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"blog/config"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io"
|
||||
)
|
||||
|
||||
type TemplatePointer struct {
|
||||
*template.Template
|
||||
}
|
||||
|
||||
type HtmlTemplate struct {
|
||||
Article TemplatePointer
|
||||
Categories TemplatePointer
|
||||
Dashboard TemplatePointer
|
||||
ExtraNav TemplatePointer
|
||||
Index TemplatePointer
|
||||
}
|
||||
|
||||
func (t TemplatePointer) WriteData(w io.Writer, data interface{}) {
|
||||
|
||||
err := t.Execute(w, data)
|
||||
if err != nil {
|
||||
if _, e := w.Write([]byte(err.Error())); e != nil {
|
||||
fmt.Println(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (t TemplatePointer) WriteError(w io.Writer, err error) {
|
||||
if _, e := w.Write([]byte(err.Error())); e != nil {
|
||||
fmt.Println(e)
|
||||
}
|
||||
}
|
||||
|
||||
func BuildViewData(title string, data interface{}) map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"Title": title,
|
||||
"Data": data,
|
||||
"Config": config.Cfg,
|
||||
"Navs": Navigation,
|
||||
}
|
||||
}
|
||||
|
||||
func initHtmlTemplate(viewDir string) (HtmlTemplate, error) {
|
||||
var htmlTemplate HtmlTemplate
|
||||
|
||||
tp, err := readHtmlTemplate(
|
||||
[]string{"index", "extraNav", "dashboard", "categories", "article"},
|
||||
viewDir)
|
||||
if err != nil {
|
||||
return htmlTemplate, err
|
||||
}
|
||||
|
||||
htmlTemplate.Index = tp[0]
|
||||
htmlTemplate.ExtraNav = tp[1]
|
||||
htmlTemplate.Dashboard = tp[2]
|
||||
htmlTemplate.Categories = tp[3]
|
||||
htmlTemplate.Article = tp[4]
|
||||
|
||||
return htmlTemplate, nil
|
||||
}
|
||||
|
||||
func SpreadDigit(n int) []int {
|
||||
var r []int
|
||||
for i := 1; i <= n; i++ {
|
||||
r = append(r, i)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
func readHtmlTemplate(htmlFileName []string, viewDir string) ([]TemplatePointer, error) {
|
||||
var htmlTemplate []TemplatePointer
|
||||
|
||||
head := viewDir + "/layouts/head.html"
|
||||
footer := viewDir + "/layouts/footer.html"
|
||||
|
||||
for _, name := range htmlFileName {
|
||||
|
||||
tp, err := template.New(name+".html").
|
||||
Funcs(template.FuncMap{"SpreadDigit": SpreadDigit}).
|
||||
ParseFiles(viewDir+"/"+name+".html", head, footer)
|
||||
if err != nil {
|
||||
return htmlTemplate, err
|
||||
}
|
||||
htmlTemplate = append(htmlTemplate, TemplatePointer{tp})
|
||||
}
|
||||
return htmlTemplate, nil
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"math"
|
||||
)
|
||||
|
||||
type PageResult struct {
|
||||
List Articles `json:"list"`
|
||||
Total int `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"pageSize"`
|
||||
TotalPage int
|
||||
}
|
||||
|
||||
func Pagination(articles *Articles, page int, pageSize int) PageResult {
|
||||
|
||||
articleLen := len(*articles)
|
||||
totalPage := int(math.Floor(float64(articleLen / pageSize)))
|
||||
|
||||
if (articleLen % pageSize) != 0 {
|
||||
totalPage++
|
||||
}
|
||||
result := PageResult{
|
||||
Total: articleLen,
|
||||
Page: page,
|
||||
PageSize: pageSize,
|
||||
TotalPage: totalPage,
|
||||
}
|
||||
if page < 1 {
|
||||
result.Page = 1
|
||||
}
|
||||
if page > result.TotalPage {
|
||||
result.Page = result.TotalPage
|
||||
}
|
||||
|
||||
if articleLen <= result.PageSize {
|
||||
result.List = (*articles)[0:articleLen]
|
||||
} else {
|
||||
startNum := (result.Page - 1) * result.PageSize
|
||||
endNum := startNum + result.PageSize
|
||||
if endNum > articleLen {
|
||||
endNum = articleLen
|
||||
}
|
||||
result.List = (*articles)[startNum:endNum]
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package routes
|
||||
|
||||
import (
|
||||
"blog/config"
|
||||
"blog/controller"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func InitRoute() {
|
||||
|
||||
http.HandleFunc("/", controller.Index)
|
||||
http.HandleFunc("/blog", controller.Index)
|
||||
http.HandleFunc("/categories", controller.Category)
|
||||
http.HandleFunc("/article", controller.Article)
|
||||
http.HandleFunc("/extra-nav", controller.ExtraNav)
|
||||
|
||||
http.HandleFunc(config.Cfg.GitHookUrl, controller.GithubHook)
|
||||
http.HandleFunc(config.Cfg.Dashboard, controller.Dashboard)
|
||||
|
||||
http.Handle("/public/", http.StripPrefix("/public/", http.FileServer(http.Dir(config.Cfg.ThemesDir+"/public"))))
|
||||
http.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(http.Dir(config.Cfg.DocumentAssetsDir))))
|
||||
http.Handle("/images/", http.StripPrefix("/images/", http.FileServer(http.Dir(config.Cfg.CurrentDir+"/images"))))
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
{{template "header" .}}
|
||||
<div class="sub-title">- {{ .Title }} -</div>
|
||||
|
||||
<h1 style="text-align: center">{{ .Data.Title }}</h1>
|
||||
|
||||
<div class="article-info">
|
||||
<span>
|
||||
<img class="icon" src="/public/img/folder.svg" alt="">
|
||||
<span>
|
||||
分类于
|
||||
<a class="category" href="/?category={{ .Data.Category }}">{{ .Data.Category }}</a>
|
||||
</span>
|
||||
</span>
|
||||
<span class="divider-line"></span>
|
||||
<span>
|
||||
<img class="icon" src="/public/img/date.svg" alt="">
|
||||
<span>发表于{{ .Data.Date.Format "2006-01-02 15:04" }}</span>
|
||||
</span>
|
||||
<span class="divider-line"></span>
|
||||
<span>
|
||||
<img class="icon" src="/public/img/tag.svg" alt="">
|
||||
<span>Tags:
|
||||
{{ range .Data.Tags }}
|
||||
<a class="category" href="/?tag={{.}}">{{.}}</a>
|
||||
{{ end }}</span>
|
||||
</span>
|
||||
<!-- <span id="busuanzi_container_page_pv">-->
|
||||
<!-- 已浏览<span id="busuanzi_value_page_pv"></span>次-->
|
||||
<!-- </span>-->
|
||||
</div>
|
||||
|
||||
{{ if ne .Data.MusicId "" }}
|
||||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/APlayer.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/Meting.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/gh/kaygb/kaygb@master/js/v3.js"></script>
|
||||
<script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/gh/kaygb/kaygb@master/layer/layer.js"></script>
|
||||
<div id="aplayer" class="aplayer" data-order="random" data-id="{{ .Data.MusicId }}" data-server="netease"
|
||||
data-type="playlist" data-fixed="true" data-autoplay="true" data-volume="0.8"></div>
|
||||
<span class="pln"><span class="pln"> </span></span>
|
||||
{{ end }}
|
||||
<div id="article" class="markdown">
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.getElementById('article').innerHTML = marked({{ .Data.Body }});
|
||||
</script>
|
||||
<script src="/public/js/prism.js"></script>
|
||||
{{if ne .Config.UtterancesRepo ""}}
|
||||
<script src="https://utteranc.es/client.js" repo="{{ .Config.UtterancesRepo }}" issue-term="[{{ .Data.Title }}]"
|
||||
theme="github-light" crossorigin="anonymous" async>
|
||||
</script>
|
||||
{{end}}
|
||||
{{template "footer" .}}
|
||||
@@ -0,0 +1,17 @@
|
||||
{{template "header" .}}
|
||||
<div class="sub-title">- {{ .Title }} -</div>
|
||||
<div class="categories">
|
||||
{{range .Data}}
|
||||
<div class="categories-card">
|
||||
<a href="/?category={{ .Name }}">
|
||||
<h3><img class="icon" src="/public/img/folder.svg" alt=""> {{ .Name }} <sub>({{ .Quantity }})</sub></h3>
|
||||
</a>
|
||||
<article class="categories-article">
|
||||
{{range .Articles}}
|
||||
<a href="/article?key={{ .ShortUrl }}">{{ .Title }}</a>
|
||||
{{end}}
|
||||
</article>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{template "footer" .}}
|
||||
@@ -0,0 +1,45 @@
|
||||
{{template "header" .}}
|
||||
<div class="sub-title">- {{ .Title }} -</div>
|
||||
<p>Search:</p>
|
||||
<div class="item-content">
|
||||
<div class="search-box">
|
||||
<input id="search-input" class="search-input" type="text">
|
||||
<img onclick="searchArticle()" class="search-icon" src="/public/img/search.svg" alt="">
|
||||
</div>
|
||||
</div>
|
||||
<p>Theme:</p>
|
||||
<div class="item-content">
|
||||
<ul class="colors">
|
||||
{{range $index, $color := .Config.ThemeOption }}
|
||||
<li onclick="selectColor('{{ $index }}')" class="{{ if eq $color $.Config.ThemeColor }}active{{end}}" style="background-color: {{ $color }}"></li>
|
||||
{{end}}
|
||||
</ul>
|
||||
</div>
|
||||
<p>Action:</p>
|
||||
<div class="item-content">
|
||||
<div class="action">
|
||||
<a href="{{ .Config.DashboardEntrance }}?action=updateArticle">更新文章</a>
|
||||
</div>
|
||||
</div>
|
||||
{{ if .Data.msg }}
|
||||
<div id="action-msg" class="action-msg">
|
||||
{{range $msg := .Data.msg }}
|
||||
<span>{{ $msg }}</span>
|
||||
{{ end }}
|
||||
<span class="close" onclick="document.getElementById('action-msg').remove()">x</span>
|
||||
</div>
|
||||
{{ end }}
|
||||
<span class="action-tip">提示:更新文章会执行git pull命令,和你的仓库网络有关,等待时间可能会稍长。</span>
|
||||
<script>
|
||||
function selectColor(index) {
|
||||
window.location.href = '{{ .Config.DashboardEntrance }}?theme=' + index
|
||||
}
|
||||
function searchArticle() {
|
||||
var searchKey = document.getElementById('search-input').value;
|
||||
searchKey = searchKey.replace(/^\s+|\s+$/g,"")
|
||||
if("" === searchKey){return}
|
||||
|
||||
window.location.href = '/?search=' + searchKey
|
||||
}
|
||||
</script>
|
||||
{{template "footer" .}}
|
||||
@@ -0,0 +1,7 @@
|
||||
{{template "header" .}}
|
||||
<div class="sub-title">- {{ .Title }} -</div>
|
||||
<div id="about"></div>
|
||||
<script>
|
||||
document.getElementById('about').innerHTML = marked({{ .Data.Body }});
|
||||
</script>
|
||||
{{template "footer" .}}
|
||||
@@ -0,0 +1,55 @@
|
||||
{{template "header" .}}
|
||||
<div class="sub-title">- {{ .Title }} -</div>
|
||||
|
||||
<ul class="articles">
|
||||
{{range .Data.List }}
|
||||
<li>
|
||||
<h2>
|
||||
<a class="title" href="/article?key={{ .ShortUrl }}">{{ .Title }}</a>
|
||||
</h2>
|
||||
<div class="article-info">
|
||||
{{ if ne .Category "" }}
|
||||
<span>
|
||||
<img class="icon" src="/public/img/folder.svg" alt="">
|
||||
<span>
|
||||
分类于
|
||||
<a class="category" href="/?category={{ .Category }}">{{ .Category }}</a>
|
||||
</span>
|
||||
</span>
|
||||
<span class="divider-line"></span>
|
||||
{{ end }}
|
||||
<span>
|
||||
<img class="icon" src="/public/img/date.svg" alt="">
|
||||
<span>发表于{{ .Date.Format "2006-01-02 15:04" }}</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="description"> {{ .Description }}...</div>
|
||||
<a class="read-all" href="/article?key={{ .ShortUrl }}" rel="contents">
|
||||
阅读全文 »
|
||||
</a>
|
||||
<div class="article-eof"></div>
|
||||
</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
|
||||
<ul class="pagination">
|
||||
{{ range $page := SpreadDigit .Data.TotalPage }}
|
||||
<li
|
||||
class="{{ if eq $page $.Data.Page }}active{{end}}"
|
||||
{{ if ne $page $.Data.Page }}onclick="goPage({{$page}})"{{end}}
|
||||
>
|
||||
<a href="javascript:;">{{ $page }}</a>
|
||||
</li>
|
||||
{{end}}
|
||||
<li style="color: #bfbfbf;">
|
||||
[{{ .Data.Total }}]
|
||||
</li>
|
||||
</ul>
|
||||
<script>
|
||||
var urlParams = currentUrlToParams();
|
||||
function goPage(page) {
|
||||
urlParams.page = page
|
||||
window.location.href = "/" + obj2StrParams(urlParams)
|
||||
}
|
||||
</script>
|
||||
{{template "footer" .}}
|
||||
@@ -0,0 +1,15 @@
|
||||
{{define "footer"}}
|
||||
</div>
|
||||
<div class="footer">
|
||||
<span>{{ .Config.Icp }}</span><span class="footer-divider"> | </span>
|
||||
<span>
|
||||
© 2018 - 2022 {{ .Config.Author }}
|
||||
Powered By <a href="{{ .Config.AppRepository }}" target="_blank"> {{ .Config.AppName }} </a>
|
||||
</span>
|
||||
<span id="busuanzi_container_site_pv" style='display:none'>
|
||||
总访问量<span id="busuanzi_value_site_pv"></span>次
|
||||
</span>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
{{ end}}
|
||||
@@ -0,0 +1,69 @@
|
||||
{{define "header"}}
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-cn">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<link rel="shortcut icon" href="public/img/favicon.ico" type="image/x-icon">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="Keywords" content="{{ .Config.HtmlKeywords }}"/>
|
||||
<meta name="description" content="{{ .Config.HtmlDescription }}"/>
|
||||
<title>{{ .Title }} - {{ .Config.SiteName }}</title>
|
||||
<style>
|
||||
:root {
|
||||
--primary: {
|
||||
{
|
||||
.Config.ThemeColor
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="/public/css/app.css">
|
||||
<link href="/public/css/prism.css" rel="stylesheet"/>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/APlayer.min.css">
|
||||
<script src="/public/js/marked.min.js"></script>
|
||||
<script async src="https://busuanzi.icodeq.com/busuanzi.pure.mini.js"></script>
|
||||
<script>
|
||||
function obj2StrParams(obj, firstStr = '?') {
|
||||
let params = firstStr;
|
||||
for (let p in obj) {
|
||||
let isFirst = (params === '?');
|
||||
let qz = isFirst ? '' : (params === '&' ? '' : '&');
|
||||
params += (qz + p + '=' + obj[p])
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
function currentUrlToParams(key = null) {
|
||||
let paramsUrl = (window.location.href).split('?');
|
||||
|
||||
if (paramsUrl.length < 2) return key ? null : {};
|
||||
let paramsArr = paramsUrl[1].split('&');
|
||||
let paramsData = {}
|
||||
|
||||
paramsArr.forEach(r => {
|
||||
let data = r.split('=')
|
||||
paramsData[data[0]] = data[1]
|
||||
})
|
||||
if (key) return paramsData.hasOwnProperty(key) ? paramsData[key] : null;
|
||||
return paramsData;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body class="theme{{ .Config.ThemeColor }}">
|
||||
<nav class="head">
|
||||
<div class="container head-content">
|
||||
<div class="logo">{{ .Config.SiteName }}</div>
|
||||
<div class="nav">
|
||||
<a href="/blog">Blog</a>
|
||||
<a href="/categories">Categories</a>
|
||||
{{range $nav := .Navs }}
|
||||
<a href="/extra-nav?name={{ $nav.Title }}">{{ $nav.Title }}</a>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="post-warp">
|
||||
{{ end }}
|
||||
@@ -0,0 +1,477 @@
|
||||
|
||||
*{
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html {
|
||||
font-family: josefin sans,-apple-system,BlinkMacSystemFont,helvetica neue,pingfang sc,hiragino sans gb,STHeiti,microsoft yahei,wenquanyi micro hei,Arial,Verdana,sans-serif;
|
||||
}
|
||||
html::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
height: 8px
|
||||
}
|
||||
|
||||
html::-webkit-scrollbar-thumb {
|
||||
height: 40px;
|
||||
background-color: #eee;
|
||||
border-radius: 0
|
||||
}
|
||||
|
||||
html::-webkit-scrollbar-thumb:hover {
|
||||
background-color: #ddd
|
||||
}
|
||||
pre{
|
||||
padding: 1em;
|
||||
margin: .5em 0;
|
||||
overflow: auto;
|
||||
background: #f5f2f0;
|
||||
}
|
||||
body{
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
|
||||
a{
|
||||
color: #161209;
|
||||
text-decoration: none;
|
||||
transition: color .2s ease,border-color .46s ease,background .46s ease,opacity .46s ease;
|
||||
}
|
||||
|
||||
a:hover{
|
||||
color: #673ab7;
|
||||
color: var(--primary,#673ab7);
|
||||
|
||||
}
|
||||
p{
|
||||
line-height: 2em;
|
||||
}
|
||||
|
||||
blockquote{
|
||||
text-indent: 2em;
|
||||
position: relative;
|
||||
margin: 20px 0;
|
||||
}
|
||||
blockquote::before{
|
||||
position: absolute;
|
||||
left: -32px;
|
||||
top: -10px;
|
||||
content: '“';
|
||||
font-family: fantasy;
|
||||
font-size: 40px;
|
||||
color: #673ab7;
|
||||
color: var(--primary,#673ab7);
|
||||
}
|
||||
|
||||
|
||||
@media screen and (max-width: 860px){
|
||||
body{
|
||||
padding: 6px;
|
||||
}
|
||||
}
|
||||
@font-face {
|
||||
font-family: josefin sans;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(//lib.baomitu.com/fonts/josefin-sans/josefin-sans-regular.eot);
|
||||
src: local("Josefin Sans"),local("JosefinSans-Normal"),url(//lib.baomitu.com/fonts/josefin-sans/josefin-sans-regular.eot?#iefix) format("embedded-opentype"),url(//lib.baomitu.com/fonts/josefin-sans/josefin-sans-regular.woff2) format("woff2"),url(//lib.baomitu.com/fonts/josefin-sans/josefin-sans-regular.woff) format("woff"),url(//lib.baomitu.com/fonts/josefin-sans/josefin-sans-regular.ttf) format("truetype"),url(//lib.baomitu.com/fonts/josefin-sans/josefin-sans-regular.svg#JosefinSans) format("svg")
|
||||
}
|
||||
|
||||
|
||||
.container {
|
||||
width: auto;
|
||||
max-width: 1200px;
|
||||
text-align: center;
|
||||
margin: 0 auto;
|
||||
|
||||
}
|
||||
|
||||
.head{
|
||||
width: 100%;
|
||||
height: 64px;
|
||||
}
|
||||
.head-content{
|
||||
display: flex;
|
||||
height: 100%;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
@media screen and (max-width: 860px){
|
||||
.head-content{
|
||||
padding-top: 10px;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
.nav a{
|
||||
padding: 0 8px;
|
||||
}
|
||||
|
||||
.sub-title {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
text-align: right;
|
||||
font-size: 32px;
|
||||
margin-bottom: 82px;
|
||||
}
|
||||
@media screen and (max-width: 860px){
|
||||
.sub-title {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
.post-warp{
|
||||
position: relative;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
max-width: 780px;
|
||||
margin: 0 auto;
|
||||
min-height: calc(100vh - 120px);
|
||||
padding: 46px 0;
|
||||
}
|
||||
@media screen and (max-width: 860px){
|
||||
.post-warp{
|
||||
min-height: calc(100vh - 132px);
|
||||
}
|
||||
}
|
||||
|
||||
.markdow img{
|
||||
width: 100%;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
|
||||
.footer{
|
||||
color: #999;
|
||||
display: flex;
|
||||
height: 54px;
|
||||
line-height: 1;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.footer-divider{
|
||||
margin: 0 10px;
|
||||
}
|
||||
@media screen and (max-width: 860px){
|
||||
.footer{
|
||||
flex-direction: column;
|
||||
}
|
||||
.footer span{
|
||||
text-align: center;
|
||||
padding: 4px 0;
|
||||
}
|
||||
.footer-divider{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.footer a{
|
||||
color: #999;
|
||||
margin: 0 8px;
|
||||
}
|
||||
pre{
|
||||
border-radius: 3px;
|
||||
font-size: 14px;
|
||||
line-height: 1.6;
|
||||
overflow: auto;
|
||||
}
|
||||
hr{
|
||||
border: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
hr:after{
|
||||
content: '';
|
||||
display: block;
|
||||
margin: 30px auto;
|
||||
width: 10%;
|
||||
height: 1px;
|
||||
background: #ccc;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
/*Categories*/
|
||||
|
||||
.categories{
|
||||
display: flex;
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
flex-wrap:wrap;
|
||||
}
|
||||
.categories-card{
|
||||
width: 50%;
|
||||
margin-bottom: 46px;
|
||||
min-height: 250px;
|
||||
padding: 0 16px;
|
||||
}
|
||||
@media screen and (max-width: 860px){
|
||||
.categories-card{
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.icon{
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
.categories-article{
|
||||
text-indent: 2em;
|
||||
}
|
||||
.categories-article a{
|
||||
display: block;
|
||||
margin-bottom: 10px;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
/*Pagination*/
|
||||
|
||||
.pagination{
|
||||
display: flex;
|
||||
margin: 60px 0;
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
padding: 0;
|
||||
}
|
||||
.pagination li{
|
||||
list-style-type: none;
|
||||
margin: 0 10px;
|
||||
width: 20px;
|
||||
}
|
||||
.pagination li a {
|
||||
text-align: center;
|
||||
display: block;
|
||||
width: 100%;
|
||||
color: #bfbfbf;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
.pagination li a:hover,.pagination .active a{
|
||||
border-bottom: 3px solid #673ab7;
|
||||
border-bottom: 3px solid var(--primary,#673ab7);
|
||||
}
|
||||
|
||||
/*Index*/
|
||||
.articles{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
min-height: 400px;
|
||||
}
|
||||
.articles li{
|
||||
padding-bottom: 8px;
|
||||
list-style-type: none;
|
||||
margin: 40px 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.articles li:after{
|
||||
content: '';
|
||||
display: block;
|
||||
margin: 60px auto;
|
||||
width: 10%;
|
||||
height: 1px;
|
||||
background: #ccc;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.articles li:last-child:after{
|
||||
display: none;
|
||||
}
|
||||
.read-all{
|
||||
display: inline-block;
|
||||
padding: 4px 20px;
|
||||
font-size: 14px;
|
||||
color: #fff;
|
||||
background: #673ab7;
|
||||
border: 2px solid #673ab7;
|
||||
background: var(--primary,#673ab7);
|
||||
border: 2px solid var(--primary,#673ab7);
|
||||
text-decoration: none;
|
||||
border-radius: 2px;
|
||||
transition-property: background-color;
|
||||
transition-duration: 0.2s;
|
||||
transition-timing-function: ease-in-out;
|
||||
transition-delay: 0s;
|
||||
}
|
||||
|
||||
.read-all:hover{
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.articles li .title{
|
||||
color: #555;
|
||||
font-size: 20px;
|
||||
font-weight: normal;
|
||||
}
|
||||
.articles li .title:hover{
|
||||
color: #673ab7;
|
||||
color: var(--primary,#673ab7);
|
||||
}
|
||||
.article-info{
|
||||
margin:20px 0 60px;
|
||||
color: #999;
|
||||
font-size: 14px;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-flow: wrap;
|
||||
}
|
||||
|
||||
.article-info img{
|
||||
position: relative;
|
||||
top: 2px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
.article-img img{
|
||||
position: relative;
|
||||
width: 300px;
|
||||
height: 200px;
|
||||
border-radius:3%;
|
||||
object-fit:cover;
|
||||
}
|
||||
.article-info .divider-line{
|
||||
width: 2px;
|
||||
height: 16px;
|
||||
background: #999;
|
||||
margin: 0 14px;
|
||||
}
|
||||
.article{
|
||||
padding: 10px 0;
|
||||
margin: 10px 0;
|
||||
}
|
||||
.articles .description{
|
||||
color: #555;
|
||||
font-size: 16px;
|
||||
text-align: left;
|
||||
line-height: 2;
|
||||
text-indent: 2em;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
@media screen and (max-width: 860px){
|
||||
.articles .description{
|
||||
padding: 0 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.sub{
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/*dashboard*/
|
||||
.item-content{
|
||||
width: 100%;
|
||||
height: 120px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.search-box{
|
||||
height: 40px;
|
||||
display: flex;
|
||||
border-radius: 2px;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
border: 1px solid #673ab7;
|
||||
border: 1px solid var(--primary,#673ab7);
|
||||
width: 320px;
|
||||
}
|
||||
.search-input{
|
||||
text-align: center;
|
||||
flex: 1;
|
||||
border: none;
|
||||
height: 30px;
|
||||
padding: 0 10px;
|
||||
}
|
||||
.search-input:focus,.search-input:active{
|
||||
border: none;
|
||||
outline:none;
|
||||
}
|
||||
.search-icon{
|
||||
cursor: pointer;
|
||||
margin: 0 10px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
.colors{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.colors li{
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
margin: 10px 20px;
|
||||
border-radius: 2px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
}
|
||||
.colors li.active:before{
|
||||
content: '';
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
background-color: #fff;
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 15px;
|
||||
left: 15px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
.action{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.action a{
|
||||
padding: 8px 16px;
|
||||
border-radius: 2px;
|
||||
opacity: .8;
|
||||
color: #fff;
|
||||
background-color: #673ab7;
|
||||
background-color: var(--primary,#673ab7);
|
||||
font-size: 14px;
|
||||
}
|
||||
.action a:hover{
|
||||
opacity: 1;
|
||||
box-shadow: 0 0 4px rgba(0,0,0,.2);
|
||||
}
|
||||
.action-tip{
|
||||
font-size: 14px;
|
||||
color: #673ab7;
|
||||
color: var(--primary,#673ab7);
|
||||
}
|
||||
.action-msg{
|
||||
z-index: 1400;
|
||||
position: fixed;
|
||||
top: 24px;
|
||||
left: auto;
|
||||
right: 24px;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 12px 16px;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
justify-content: center;
|
||||
opacity: 1;
|
||||
min-width: 288px;
|
||||
border-radius: 4px;
|
||||
background-color: #673ab7;
|
||||
background-color: var(--primary,#673ab7);
|
||||
box-shadow: 0 3px 5px -1px rgba(0,0,0,0.2), 0 6px 10px 0 rgba(0,0,0,0.14), 0 1px 18px 0 rgba(0,0,0,0.12);
|
||||
}
|
||||
.action-msg .close{
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
top: auto;
|
||||
font-size: 16px;
|
||||
right: 24px;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
/* PrismJS 1.28.0
|
||||
https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+bash+c+cpp+cmake+go+java+json+json5+kotlin+lua+markup-templating+nginx+php+python+verilog+yaml&plugins=line-highlight+show-language+toolbar+copy-to-clipboard */
|
||||
code[class*=language-],pre[class*=language-]{color:#000;background:0 0;text-shadow:0 1px #fff;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}code[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,pre[class*=language-]::-moz-selection{text-shadow:none;background:#b3d4fc}code[class*=language-] ::selection,code[class*=language-]::selection,pre[class*=language-] ::selection,pre[class*=language-]::selection{text-shadow:none;background:#b3d4fc}@media print{code[class*=language-],pre[class*=language-]{text-shadow:none}}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#f5f2f0}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#708090}.token.punctuation{color:#999}.token.namespace{opacity:.7}.token.boolean,.token.constant,.token.deleted,.token.number,.token.property,.token.symbol,.token.tag{color:#905}.token.attr-name,.token.builtin,.token.char,.token.inserted,.token.selector,.token.string{color:#690}.language-css .token.string,.style .token.string,.token.entity,.token.operator,.token.url{color:#9a6e3a;background:hsla(0,0%,100%,.5)}.token.atrule,.token.attr-value,.token.keyword{color:#07a}.token.class-name,.token.function{color:#dd4a68}.token.important,.token.regex,.token.variable{color:#e90}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}
|
||||
pre[data-line]{position:relative;padding:1em 0 1em 3em}.line-highlight{position:absolute;left:0;right:0;padding:inherit 0;margin-top:1em;background:hsla(24,20%,50%,.08);background:linear-gradient(to right,hsla(24,20%,50%,.1) 70%,hsla(24,20%,50%,0));pointer-events:none;line-height:inherit;white-space:pre}@media print{.line-highlight{-webkit-print-color-adjust:exact;color-adjust:exact}}.line-highlight:before,.line-highlight[data-end]:after{content:attr(data-start);position:absolute;top:.4em;left:.6em;min-width:1em;padding:0 .5em;background-color:hsla(24,20%,50%,.4);color:#f4f1ef;font:bold 65%/1.5 sans-serif;text-align:center;vertical-align:.3em;border-radius:999px;text-shadow:none;box-shadow:0 1px #fff}.line-highlight[data-end]:after{content:attr(data-end);top:auto;bottom:.4em}.line-numbers .line-highlight:after,.line-numbers .line-highlight:before{content:none}pre[id].linkable-line-numbers span.line-numbers-rows{pointer-events:all}pre[id].linkable-line-numbers span.line-numbers-rows>span:before{cursor:pointer}pre[id].linkable-line-numbers span.line-numbers-rows>span:hover:before{background-color:rgba(128,128,128,.2)}
|
||||
div.code-toolbar{position:relative}div.code-toolbar>.toolbar{position:absolute;z-index:10;top:.3em;right:.2em;transition:opacity .3s ease-in-out;opacity:0}div.code-toolbar:hover>.toolbar{opacity:1}div.code-toolbar:focus-within>.toolbar{opacity:1}div.code-toolbar>.toolbar>.toolbar-item{display:inline-block}div.code-toolbar>.toolbar>.toolbar-item>a{cursor:pointer}div.code-toolbar>.toolbar>.toolbar-item>button{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;padding:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}div.code-toolbar>.toolbar>.toolbar-item>a,div.code-toolbar>.toolbar>.toolbar-item>button,div.code-toolbar>.toolbar>.toolbar-item>span{color:#bbb;font-size:.8em;padding:0 .5em;background:#f5f2f0;background:rgba(224,224,224,.2);box-shadow:0 2px 0 0 rgba(0,0,0,.2);border-radius:.5em}div.code-toolbar>.toolbar>.toolbar-item>a:focus,div.code-toolbar>.toolbar>.toolbar-item>a:hover,div.code-toolbar>.toolbar>.toolbar-item>button:focus,div.code-toolbar>.toolbar>.toolbar-item>button:hover,div.code-toolbar>.toolbar>.toolbar-item>span:focus,div.code-toolbar>.toolbar>.toolbar-item>span:hover{color:inherit;text-decoration:none}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1556811784413" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3571" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M508.34940208 792.26591763c-22.11718637 0-41.00975882-7.11308325-56.67650371-21.35017245-15.66674489-14.23102103-25.65006222-35.48046222-29.95116562-63.7422554l-58.0600415 4.9152c3.68579318 37.8919443 18.47993837 68.30307555 44.38850372 91.23703467 25.90613808 22.94002725 59.33677985 34.4064 100.29920711 34.4064 49.96634548 0 89.39353125-18.22507615 118.26942103-54.68008297 23.75558637-29.69144889 35.63459318-64.91704889 35.63459319-105.67437273 0-42.80107615-13.51740682-77.82035911-40.54979319-105.06027616-27.03238637-27.23263525-60.21059318-40.85562785-99.53097956-40.85562784-29.69751703 0-58.05882785 9.06338608-85.09121422 27.9025588L461.34916741 437.96859259H640.64474075v-52.18607407H417.11236741l-43.62027616 231.3505754 51.91543467 6.7744806c8.18835911-12.90209659 19.45448297-23.38542933 33.79230341-31.47912534 14.3317523-8.08520059 30.41113125-12.12901452 48.22721422-12.12901451 28.672 0 51.86324859 9.11799941 69.57981393 27.3406483 17.71171082 18.22993067 26.57242075 43.11540622 26.57242074 74.65035851 0 33.17699318-9.21508978 59.80281363-27.64648297 79.87139319-18.43260682 20.07100682-40.96242725 30.10408297-67.58339317 30.10408296z" fill="#999"></path><path d="M894.81762133 50.82074075H131.55259733C85.31694933 50.82074075 47.17985185 88.05732503 47.17985185 134.29418667v756.1337363C47.17985185 936.66478459 85.31694933 974.39288889 131.55259733 974.39288889h763.41551408C941.20497303 974.39288889 978.03377778 936.66478459 978.03377778 890.42792297V134.29418667c0-46.23686163-36.98050845-83.47344592-83.21615645-83.47344592zM732.27377778 117.57037037c30.16233718 0 54.61333333 24.45099615 54.61333333 54.61333333s-24.45099615 54.61333333-54.61333333 54.61333333-54.61333333-24.45099615-54.61333333-54.61333333 24.45099615-54.61333333 54.61333333-54.61333333z m-439.33392593 0c30.16233718 0 54.61333333 24.45099615 54.61333333 54.61333333s-24.45099615 54.61333333-54.61333333 54.61333333-54.61333333-24.45099615-54.61333333-54.61333333 24.45099615-54.61333333 54.61333333-54.61333333zM905.216 890.42792297c0 6.01110755-4.23556741 11.14718815-10.24667497 11.14718814H131.55259733c-6.01110755 0-11.5549677-5.13486697-11.5549677-11.14718814V276.55585185h785.21837037v613.87207112z" fill="#999"></path></svg>
|
||||
|
After Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1558276399452" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2757" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><defs><style type="text/css"></style></defs><path d="M511.939185 874.030645C312.344934 874.030645 149.969355 711.655066 149.969355 511.939185c0-199.594251 162.375579-361.96983 361.96983-361.96983 199.594251 0 361.96983 162.375579 361.96983 361.96983 0.12163 199.715881-162.253949 362.09146-361.96983 362.09146z m0-677.963654C337.76553 196.066991 195.945362 337.76553 195.945362 512.060815s141.698539 315.993823 315.993823 315.993823S827.933009 686.356099 827.933009 512.060815 686.23447 196.066991 511.939185 196.066991z" fill="#5B5C5C" p-id="2758"></path><path d="M554.144673 333.265233c-17.636299-35.759116-28.461337-70.666825-33.934672-90.978976V498.681554c9.000594 3.40563 15.325336 11.919705 15.325336 22.014966 0 13.014372-10.581779 23.596152-23.596152 23.596151s-23.596152-10.581779-23.596151-23.596151c0-10.581779 7.05452-19.460744 16.663261-22.379855V242.042998c-5.473334 20.190521-16.298373 55.21986-34.056301 91.222235-27.73156 56.071267-62.274379 105.452904-62.274379 105.452905L430.93384 741.089441s21.041929 23.474522 81.613493 23.474521c60.693194 0 81.613493-23.474522 81.613494-23.474521l22.136595-302.371303c0.12163 0-34.42119-49.381637-62.152749-105.452905z" fill="#5B5C5C" p-id="2759"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M853.333333 938.666667H170.666667c-72.533333 0-128-55.466667-128-128V213.333333c0-72.533333 55.466667-128 128-128h213.333333c12.8 0 25.6 8.533333 34.133333 17.066667L490.666667 213.333333H853.333333c72.533333 0 128 55.466667 128 128v469.333334c0 72.533333-55.466667 128-128 128zM170.666667 170.666667c-25.6 0-42.666667 17.066667-42.666667 42.666666v597.333334c0 25.6 17.066667 42.666667 42.666667 42.666666h682.666666c25.6 0 42.666667-17.066667 42.666667-42.666666V341.333333c0-25.6-17.066667-42.666667-42.666667-42.666666h-384c-12.8 0-25.6-8.533333-34.133333-17.066667L362.666667 170.666667H170.666667z" fill="#999"></path></svg>
|
||||
|
After Width: | Height: | Size: 922 B |
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1566293108350" class="icon" viewBox="0 0 1030 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2103" width="48.28125" height="48" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css"></style></defs><path d="M738.618409 646.405992c96.606263 96.606263 192.944918 192.944918 290.889218 290.621611-31.310063 29.169204-62.352519 57.803193-93.662582 86.972397-93.662582-93.662582-190.001237-190.001237-286.875107-286.875107-104.099269 71.451169-215.691545 95.535833-336.917687 66.901844-96.87387-22.746627-175.015224-75.732887-233.621239-156.282708-120.690927-165.648966-98.747122-390.439162 42.81718-530.130212 149.860131-147.719272 377.861615-153.339027 534.947145-33.450922C814.08369 205.389036 876.436208 448.644141 738.618409 646.405992zM728.984544 407.700212C728.984544 230.008915 585.814598 86.036146 408.658514 86.036146 231.502431 86.036146 86.994448 230.276522 86.994448 407.164998c0 178.226513 143.972768 322.466888 321.664066 321.664066C587.152634 728.293849 728.984544 585.926725 728.984544 407.700212z" p-id="2104"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1711012507479" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1625" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M648.32 715.072l-124.992 125.056a224 224 0 0 1-316.8 0l-22.656-22.656a224 224 0 0 1 0-316.8L308.48 376.064l63.488 63.232-124.736 124.8a134.4 134.4 0 0 0-6.528 183.04l6.528 7.04 22.656 22.592a134.4 134.4 0 0 0 183.04 6.528l7.04-6.528 124.928-124.992 63.36 63.296z m-44.288-295.04a44.8 44.8 0 0 1 0 63.36L484.736 602.56a44.8 44.8 0 1 1-63.36-63.36l119.296-119.232a44.8 44.8 0 0 1 63.36 0z m236.032-213.504a224 224 0 0 1 0 316.8l-123.84 123.84-63.488-63.296 123.968-123.904a134.4 134.4 0 0 0 6.592-183.04l-6.592-7.04-22.592-22.592a134.4 134.4 0 0 0-183.04-6.592l-7.04 6.592-124.224 124.16-63.488-63.232 124.352-124.288a224 224 0 0 1 316.8 0l22.592 22.592z" p-id="1626"></path></svg>
|
||||
|
After Width: | Height: | Size: 1012 B |
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* marked - a markdown parser
|
||||
* Copyright (c) 2011-2018, Christopher Jeffrey. (MIT Licensed)
|
||||
* https://github.com/markedjs/marked
|
||||
*/
|
||||
!function(e){"use strict";var k={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:f,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,nptable:f,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,table:f,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/,text:/^[^\n]+/};function a(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||b.defaults,this.rules=k.normal,this.options.pedantic?this.rules=k.pedantic:this.options.gfm&&(this.options.tables?this.rules=k.tables:this.rules=k.gfm)}k._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,k._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,k.def=i(k.def).replace("label",k._label).replace("title",k._title).getRegex(),k.bullet=/(?:[*+-]|\d{1,9}\.)/,k.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,k.item=i(k.item,"gm").replace(/bull/g,k.bullet).getRegex(),k.list=i(k.list).replace(/bull/g,k.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+k.def.source+")").getRegex(),k._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",k._comment=/<!--(?!-?>)[\s\S]*?-->/,k.html=i(k.html,"i").replace("comment",k._comment).replace("tag",k._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),k.paragraph=i(k.paragraph).replace("hr",k.hr).replace("heading",k.heading).replace("lheading",k.lheading).replace("tag",k._tag).getRegex(),k.blockquote=i(k.blockquote).replace("paragraph",k.paragraph).getRegex(),k.normal=d({},k),k.gfm=d({},k.normal,{fences:/^ {0,3}(`{3,}|~{3,})([^`\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),k.gfm.paragraph=i(k.paragraph).replace("(?!","(?!"+k.gfm.fences.source.replace("\\1","\\2")+"|"+k.list.source.replace("\\1","\\3")+"|").getRegex(),k.tables=d({},k.gfm,{nptable:/^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,table:/^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/}),k.pedantic=d({},k.normal,{html:i("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",k._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/}),a.rules=k,a.lex=function(e,t){return new a(t).lex(e)},a.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},a.prototype.token=function(e,t){var n,r,s,i,l,o,a,h,p,u,c,g,f,d,m,b;for(e=e.replace(/^ +$/gm,"");e;)if((s=this.rules.newline.exec(e))&&(e=e.substring(s[0].length),1<s[0].length&&this.tokens.push({type:"space"})),s=this.rules.code.exec(e))e=e.substring(s[0].length),s=s[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?s:y(s,"\n")});else if(s=this.rules.fences.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"code",lang:s[2]?s[2].trim():s[2],text:s[3]||""});else if(s=this.rules.heading.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"heading",depth:s[1].length,text:s[2]});else if((s=this.rules.nptable.exec(e))&&(o={type:"table",header:x(s[1].replace(/^ *| *\| *$/g,"")),align:s[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:s[3]?s[3].replace(/\n$/,"").split("\n"):[]}).header.length===o.align.length){for(e=e.substring(s[0].length),c=0;c<o.align.length;c++)/^ *-+: *$/.test(o.align[c])?o.align[c]="right":/^ *:-+: *$/.test(o.align[c])?o.align[c]="center":/^ *:-+ *$/.test(o.align[c])?o.align[c]="left":o.align[c]=null;for(c=0;c<o.cells.length;c++)o.cells[c]=x(o.cells[c],o.header.length);this.tokens.push(o)}else if(s=this.rules.hr.exec(e))e=e.substring(s[0].length),this.tokens.push({typeLine truncated
|
||||
@@ -0,0 +1,27 @@
|
||||
/* PrismJS 1.28.0
|
||||
https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+bash+c+cpp+cmake+go+java+json+json5+kotlin+lua+markup-templating+nginx+php+python+verilog+yaml&plugins=line-highlight+show-language+toolbar+copy-to-clipboard */
|
||||
var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(e){var n=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,t=0,r={},a={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(n){return n instanceof i?new i(n.type,e(n.content),n.alias):Array.isArray(n)?n.map(e):n.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function e(n,t){var r,i;switch(t=t||{},a.util.type(n)){case"Object":if(i=a.util.objId(n),t[i])return t[i];for(var l in r={},t[i]=r,n)n.hasOwnProperty(l)&&(r[l]=e(n[l],t));return r;case"Array":return i=a.util.objId(n),t[i]?t[i]:(r=[],t[i]=r,n.forEach((function(n,a){r[a]=e(n,t)})),r);default:return n}},getLanguage:function(e){for(;e;){var t=n.exec(e.className);if(t)return t[1].toLowerCase();e=e.parentElement}return"none"},setLanguage:function(e,t){e.className=e.className.replace(RegExp(n,"gi"),""),e.classList.add("language-"+t)},currentScript:function(){if("undefined"==typeof document)return null;if("currentScript"in document)return document.currentScript;try{throw new Error}catch(r){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(r.stack)||[])[1];if(e){var n=document.getElementsByTagName("script");for(var t in n)if(n[t].src==e)return n[t]}return null}},isActive:function(e,n,t){for(var r="no-"+n;e;){var a=e.classList;if(a.contains(n))return!0;if(a.contains(r))return!1;e=e.parentElement}return!!t}},languages:{plain:r,plaintext:r,text:r,txt:r,extend:function(e,n){var t=a.util.clone(a.languages[e]);for(var r in n)t[r]=n[r];return t},insertBefore:function(e,n,t,r){var i=(r=r||a.languages)[e],l={};for(var o in i)if(i.hasOwnProperty(o)){if(o==n)for(var s in t)t.hasOwnProperty(s)&&(l[s]=t[s]);t.hasOwnProperty(o)||(l[o]=i[o])}var u=r[e];return r[e]=l,a.languages.DFS(a.languages,(function(n,t){t===u&&n!=e&&(this[n]=l)})),l},DFS:function e(n,t,r,i){i=i||{};var l=a.util.objId;for(var o in n)if(n.hasOwnProperty(o)){t.call(n,o,n[o],r||o);var s=n[o],u=a.util.type(s);"Object"!==u||i[l(s)]?"Array"!==u||i[l(s)]||(i[l(s)]=!0,e(s,t,o,i)):(i[l(s)]=!0,e(s,t,null,i))}}},plugins:{},highlightAll:function(e,n){a.highlightAllUnder(document,e,n)},highlightAllUnder:function(e,n,t){var r={callback:t,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};a.hooks.run("before-highlightall",r),r.elements=Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)),a.hooks.run("before-all-elements-highlight",r);for(var i,l=0;i=r.elements[l++];)a.highlightElement(i,!0===n,r.callback)},highlightElement:function(n,t,r){var i=a.util.getLanguage(n),l=a.languages[i];a.util.setLanguage(n,i);var o=n.parentElement;o&&"pre"===o.nodeName.toLowerCase()&&a.util.setLanguage(o,i);var s={element:n,language:i,grammar:l,code:n.textContent};function u(e){s.highlightedCode=e,a.hooks.run("before-insert",s),s.element.innerHTML=s.highlightedCode,a.hooks.run("after-highlight",s),a.hooks.run("complete",s),r&&r.call(s.element)}if(a.hooks.run("before-sanity-check",s),(o=s.element.parentElement)&&"pre"===o.nodeName.toLowerCase()&&!o.hasAttribute("tabindex")&&o.setAttribute("tabindex","0"),!s.code)return a.hooks.run("complete",s),void(r&&r.call(s.element));if(a.hooks.run("before-highlight",s),s.grammar)if(t&&e.Worker){var c=new Worker(a.filename);c.onmessage=function(e){u(e.data)},c.postMessage(JSON.stringify({language:s.language,code:s.code,immediateClose:!0}))}else u(a.highlight(s.code,s.grammar,s.language));else u(a.util.encode(s.code))},highlight:function(e,n,t){var r={code:e,grammar:n,language:t};if(a.hooks.run("before-tokenize",r),!r.grammar)throw new Error('The language "'+r.language+'" has no grammar.');return r.tokens=a.tokenize(r.code,r.grammar),a.hooks.run("after-tokenize",r),i.stringify(a.util.encode(r.tokens),r.language)},tokenize:function(e,n){var t=n.rest;if(t){for(var r in t)n[r]=t[r];delete n.rest}var a=new s;return u(a,a.head,e),o(e,a,n,a.head,0),function(e){for(var n=[],t=e.head.next;t!==e.tail;)n.push(t.value),t=t.next;return n}(a)},hooks:{all:{},add:function(e,n){var t=a.hooks.all;t[e]=t[e]||[],t[e].push(n)},run:function(e,n){var t=a.hooks.all[e];if(t&&t.length)for(var r,i=0;r=t[i++];)r(n)}},Token:i};function i(e,n,t,r){this.type=e,this.content=n,this.alias=t,this.length=0|(r||"").length}function l(e,n,t,r){e.lastIndex=n;var a=e.exec(t);if(a&&r&&a[1]){var i=a[1].length;a.index+=i,a[0]=a[0].slice(i)}return a}function o(e,n,t,r,s,g){for(var f in t)if(t.hasOwnProperty(f)&&t[f]){var h=t[f];h=Array.isArray(h)?h:[h];for(var d=0;d<h.length;++d){if(g&&g.cause==f+","+d)return;var v=h[d],p=v.inside,m=!!v.lookbehind,y=!!v.greedy,k=v.alias;if(y&&!v.pattern.global){var x=v.pattern.toString().match(/[imsuy]*$/)[0];v.pattern=RegExp(v.pattern.source,x+"g"Line truncated
|
||||
Prism.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",(function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))})),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(a,e){var s={};s["language-"+e]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[e]},s.cdata=/^<!\[CDATA\[|\]\]>$/i;var t={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:s}};t["language-"+e]={pattern:/[\s\S]+/,inside:Prism.languages[e]};var n={};n[a]={pattern:RegExp("(<__[^>]*>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[^])*?(?=</__>)".replace(/__/g,(function(){return a})),"i"),lookbehind:!0,greedy:!0,inside:t},Prism.languages.insertBefore("markup","cdata",n)}}),Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(a,e){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp("(^|[\"'\\s])(?:"+a+")\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s'\">=]+(?=[\\s>]))","i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[e,"language-"+e],inside:Prism.languages[e]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml;
|
||||
!function(s){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;s.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:[^;{\\s\"']|\\s+(?!\\s)|"+e.source+")*?(?:;|(?=\\s*\\{))"),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|(?:[^\\\\\r\n()\"']|\\\\[^])*)\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},s.languages.css.atrule.inside.rest=s.languages.css;var t=s.languages.markup;t&&(t.tag.addInlined("style","css"),t.tag.addAttribute("style","css"))}(Prism);
|
||||
Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};
|
||||
Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp("(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])"),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp("((?:^|[^$\\w\\xA0-\\uFFFF.\"'\\])\\s]|\\b(?:return|yield))\\s*)/(?:(?:\\[(?:[^\\]\\\\\r\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\r\n])+/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\r\n]|\\\\.|\\[(?:[^[\\]\\\\\r\n]|\\\\.|\\[(?:[^[\\]\\\\\r\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\r\n])+/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|/\\*(?:[^*]|\\*(?!/))*\\*/)*(?:$|[\r\n,.;:})\\]]|//))"),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute("on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)","javascript")),Prism.languages.js=Prism.languages.javascript;
|
||||
!function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},a={bash:n,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:a},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:a},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:a.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:a.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|evaLine truncated
|
||||
Prism.languages.c=Prism.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),Prism.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),Prism.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},Prism.languages.c.string],char:Prism.languages.c.char,comment:Prism.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:Prism.languages.c}}}}),Prism.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete Prism.languages.c.boolean;
|
||||
!function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n="\\b(?!<keyword>)\\w+(?:\\s*\\.\\s*\\w+)*\\b".replace(/<keyword>/g,(function(){return t.source}));e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp("(\\b(?:class|concept|enum|struct|typename)\\s+)(?!<keyword>)\\w+".replace(/<keyword>/g,(function(){return t.source}))),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore("cpp","string",{module:{pattern:RegExp('(\\b(?:import|module)\\s+)(?:"(?:\\\\(?:\r\n|[^])|[^"\\\\\r\n])*"|<[^<>\r\n]*>|'+"<mod-name>(?:\\s*:\\s*<mod-name>)?|:\\s*<mod-name>".replace(/<mod-name>/g,(function(){return n}))+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),e.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e.languages.cpp}}}}),e.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),e.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend("cpp",{})}}),e.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp["base-clause"])}(Prism);
|
||||
Prism.languages.cmake={comment:/#.*/,string:{pattern:/"(?:[^\\"]|\\.)*"/,greedy:!0,inside:{interpolation:{pattern:/\$\{(?:[^{}$]|\$\{[^{}$]*\})*\}/,inside:{punctuation:/\$\{|\}/,variable:/\w+/}}}},variable:/\b(?:CMAKE_\w+|\w+_(?:(?:BINARY|SOURCE)_DIR|DESCRIPTION|HOMEPAGE_URL|ROOT|VERSION(?:_MAJOR|_MINOR|_PATCH|_TWEAK)?)|(?:ANDROID|APPLE|BORLAND|BUILD_SHARED_LIBS|CACHE|CPACK_(?:ABSOLUTE_DESTINATION_FILES|COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY|ERROR_ON_ABSOLUTE_INSTALL_DESTINATION|INCLUDE_TOPLEVEL_DIRECTORY|INSTALL_DEFAULT_DIRECTORY_PERMISSIONS|INSTALL_SCRIPT|PACKAGING_INSTALL_PREFIX|SET_DESTDIR|WARN_ON_ABSOLUTE_INSTALL_DESTINATION)|CTEST_(?:BINARY_DIRECTORY|BUILD_COMMAND|BUILD_NAME|BZR_COMMAND|BZR_UPDATE_OPTIONS|CHANGE_ID|CHECKOUT_COMMAND|CONFIGURATION_TYPE|CONFIGURE_COMMAND|COVERAGE_COMMAND|COVERAGE_EXTRA_FLAGS|CURL_OPTIONS|CUSTOM_(?:COVERAGE_EXCLUDE|ERROR_EXCEPTION|ERROR_MATCH|ERROR_POST_CONTEXT|ERROR_PRE_CONTEXT|MAXIMUM_FAILED_TEST_OUTPUT_SIZE|MAXIMUM_NUMBER_OF_(?:ERRORS|WARNINGS)|MAXIMUM_PASSED_TEST_OUTPUT_SIZE|MEMCHECK_IGNORE|POST_MEMCHECK|POST_TEST|PRE_MEMCHECK|PRE_TEST|TESTS_IGNORE|WARNING_EXCEPTION|WARNING_MATCH)|CVS_CHECKOUT|CVS_COMMAND|CVS_UPDATE_OPTIONS|DROP_LOCATION|DROP_METHOD|DROP_SITE|DROP_SITE_CDASH|DROP_SITE_PASSWORD|DROP_SITE_USER|EXTRA_COVERAGE_GLOB|GIT_COMMAND|GIT_INIT_SUBMODULES|GIT_UPDATE_CUSTOM|GIT_UPDATE_OPTIONS|HG_COMMAND|HG_UPDATE_OPTIONS|LABELS_FOR_SUBPROJECTS|MEMORYCHECK_(?:COMMAND|COMMAND_OPTIONS|SANITIZER_OPTIONS|SUPPRESSIONS_FILE|TYPE)|NIGHTLY_START_TIME|P4_CLIENT|P4_COMMAND|P4_OPTIONS|P4_UPDATE_OPTIONS|RUN_CURRENT_SCRIPT|SCP_COMMAND|SITE|SOURCE_DIRECTORY|SUBMIT_URL|SVN_COMMAND|SVN_OPTIONS|SVN_UPDATE_OPTIONS|TEST_LOAD|TEST_TIMEOUT|TRIGGER_SITE|UPDATE_COMMAND|UPDATE_OPTIONS|UPDATE_VERSION_ONLY|USE_LAUNCHERS)|CYGWIN|ENV|EXECUTABLE_OUTPUT_PATH|GHS-MULTI|IOS|LIBRARY_OUTPUT_PATH|MINGW|MSVC(?:10|11|12|14|60|70|71|80|90|_IDE|_TOOLSET_VERSION|_VERSION)?|MSYS|PROJECT_NAME|UNIX|WIN32|WINCE|WINDOWS_PHONE|WINDOWS_STORE|XCODE))\b/,property:/\b(?:cxx_\w+|(?:ARCHIVE_OUTPUT_(?:DIRECTORY|NAME)|COMPILE_DEFINITIONS|COMPILE_PDB_NAME|COMPILE_PDB_OUTPUT_DIRECTORY|EXCLUDE_FROM_DEFAULT_BUILD|IMPORTED_(?:IMPLIB|LIBNAME|LINK_DEPENDENT_LIBRARIES|LINK_INTERFACE_LANGUAGES|LINK_INTERFACE_LIBRARIES|LINK_INTERFACE_MULTIPLICITY|LOCATION|NO_SONAME|OBJECTS|SONAME)|INTERPROCEDURAL_OPTIMIZATION|LIBRARY_OUTPUT_DIRECTORY|LIBRARY_OUTPUT_NAME|LINK_FLAGS|LINK_INTERFACE_LIBRARIES|LINK_INTERFACE_MULTIPLICITY|LOCATION|MAP_IMPORTED_CONFIG|OSX_ARCHITECTURES|OUTPUT_NAME|PDB_NAME|PDB_OUTPUT_DIRECTORY|RUNTIME_OUTPUT_DIRECTORY|RUNTIME_OUTPUT_NAME|STATIC_LIBRARY_FLAGS|VS_CSHARP|VS_DOTNET_REFERENCEPROP|VS_DOTNET_REFERENCE|VS_GLOBAL_SECTION_POST|VS_GLOBAL_SECTION_PRE|VS_GLOBAL|XCODE_ATTRIBUTE)_\w+|\w+_(?:CLANG_TIDY|COMPILER_LAUNCHER|CPPCHECK|CPPLINT|INCLUDE_WHAT_YOU_USE|OUTPUT_NAME|POSTFIX|VISIBILITY_PRESET)|ABSTRACT|ADDITIONAL_MAKE_CLEAN_FILES|ADVANCED|ALIASED_TARGET|ALLOW_DUPLICATE_CUSTOM_TARGETS|ANDROID_(?:ANT_ADDITIONAL_OPTIONS|API|API_MIN|ARCH|ASSETS_DIRECTORIES|GUI|JAR_DEPENDENCIES|NATIVE_LIB_DEPENDENCIES|NATIVE_LIB_DIRECTORIES|PROCESS_MAX|PROGUARD|PROGUARD_CONFIG_PATH|SECURE_PROPS_PATH|SKIP_ANT_STEP|STL_TYPE)|ARCHIVE_OUTPUT_DIRECTORY|ATTACHED_FILES|ATTACHED_FILES_ON_FAIL|AUTOGEN_(?:BUILD_DIR|ORIGIN_DEPENDS|PARALLEL|SOURCE_GROUP|TARGETS_FOLDER|TARGET_DEPENDS)|AUTOMOC|AUTOMOC_(?:COMPILER_PREDEFINES|DEPEND_FILTERS|EXECUTABLE|MACRO_NAMES|MOC_OPTIONS|SOURCE_GROUP|TARGETS_FOLDER)|AUTORCC|AUTORCC_EXECUTABLE|AUTORCC_OPTIONS|AUTORCC_SOURCE_GROUP|AUTOUIC|AUTOUIC_EXECUTABLE|AUTOUIC_OPTIONS|AUTOUIC_SEARCH_PATHS|BINARY_DIR|BUILDSYSTEM_TARGETS|BUILD_RPATH|BUILD_RPATH_USE_ORIGIN|BUILD_WITH_INSTALL_NAME_DIR|BUILD_WITH_INSTALL_RPATH|BUNDLE|BUNDLE_EXTENSION|CACHE_VARIABLES|CLEAN_NO_CUSTOM|COMMON_LANGUAGE_RUNTIME|COMPATIBLE_INTERFACE_(?:BOOL|NUMBER_MAX|NUMBER_MIN|STRING)|COMPILE_(?:DEFINITIONS|FEATURES|FLAGS|OPTIONS|PDB_NAME|PDB_OUTPUT_DIRECTORY)|COST|CPACK_DESKTOP_SHORTCUTS|CPACK_NEVER_OVERWRITE|CPACK_PERMANENT|CPACK_STARTUP_SHORTCUTS|CPACK_START_MENU_SHORTCUTS|CPACK_WIX_ACL|CROSSCOMPILING_EMULATOR|CUDA_EXTENSIONS|CUDA_PTX_COMPILATION|CUDA_RESOLVE_DEVICE_SYMBOLS|CUDA_SEPARABLE_COMPILATION|CUDA_STANDARD|CUDA_STANDARD_REQUIRED|CXX_EXTENSIONS|CXX_STANDARD|CXX_STANDARD_REQUIRED|C_EXTENSIONS|C_STANDARD|C_STANDARD_REQUIRED|DEBUG_CONFIGURATIONS|DEFINE_SYMBOL|DEFINITIONS|DEPENDS|DEPLOYMENT_ADDITIONAL_FILES|DEPLOYMENT_REMOTE_DIRECTORY|DISABLED|DISABLED_FEATURES|ECLIPSE_EXTRA_CPROJECT_CONTENTS|ECLIPSE_EXTRA_NATURES|ENABLED_FEATURES|ENABLED_LANGUAGES|ENABLE_EXPORTS|ENVIRONMENT|EXCLUDE_FROM_ALL|EXCLUDE_FROM_DEFAULT_BUILD|EXPORT_NAME|EXPORT_PROPERTIES|EXTERNAL_OBJECT|EchoString|FAIL_REGULAR_EXPRESSION|FIND_LIBRARY_USE_LIB32_PATHS|FIND_LIBRARY_USE_LIB64_PATHS|FIND_LIBRARY_USE_LIBX32_PATHS|FIND_LIBRARY_USE_OPENBSD_VERSIONING|FIXTURES_CLEANUP|FIXTURES_REQUIRED|FIXTURES_SETUP|FOLDER|FRAMEWORK|Fortran_FORMAT|Fortran_MODULE_DIRECTORY|GENERATED|GENERATOR_FILE_NAME|GENERATOR_IS_MULTI_CONFIG|GHS_INTEGRITY_APP|GHS_NO_SOURCE_GROUP_FILE|GLOBAL_DEPENDS_DEBUG_MODE|GLOBLine truncated
|
||||
Prism.languages.go=Prism.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),Prism.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete Prism.languages.go["class-name"];
|
||||
!function(e){var n=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,t="(?:[a-z]\\w*\\s*\\.\\s*)*(?:[A-Z]\\w*\\s*\\.\\s*)*",s={pattern:RegExp("(^|[^\\w.])"+t+"[A-Z](?:[\\d_A-Z]*[a-z]\\w*)?\\b"),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};e.languages.java=e.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[s,{pattern:RegExp("(^|[^\\w.])"+t+"[A-Z]\\w*(?=\\s+\\w+\\s*[;,=()]|\\s*(?:\\[[\\s,]*\\]\\s*)?::\\s*new\\b)"),lookbehind:!0,inside:s.inside},{pattern:RegExp("(\\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\\s+)"+t+"[A-Z]\\w*\\b"),lookbehind:!0,inside:s.inside}],keyword:n,function:[e.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0}}),e.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),e.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":s,keyword:n,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp("(\\bimport\\s+)"+t+"(?:[A-Z]\\w*|\\*)(?=\\s*;)"),lookbehind:!0,inside:{namespace:s.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp("(\\bimport\\s+static\\s+)"+t+"(?:\\w+|\\*)(?=\\s*;)"),lookbehind:!0,alias:"static",inside:{namespace:s.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp("(\\b(?:exports|import(?:\\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\\s+)(?!<keyword>)[a-z]\\w*(?:\\.[a-z]\\w*)*\\.?".replace(/<keyword>/g,(function(){return n.source}))),lookbehind:!0,inside:{punctuation:/\./}}})}(Prism);
|
||||
Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},Prism.languages.webmanifest=Prism.languages.json;
|
||||
!function(n){var e=/("|')(?:\\(?:\r\n?|\n|.)|(?!\1)[^\\\r\n])*\1/;n.languages.json5=n.languages.extend("json",{property:[{pattern:RegExp(e.source+"(?=\\s*:)"),greedy:!0},{pattern:/(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/,alias:"unquoted"}],string:{pattern:e,greedy:!0},number:/[+-]?\b(?:NaN|Infinity|0x[a-fA-F\d]+)\b|[+-]?(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[eE][+-]?\d+\b)?/})}(Prism);
|
||||
!function(n){n.languages.kotlin=n.languages.extend("clike",{keyword:{pattern:/(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,lookbehind:!0},function:[{pattern:/(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,greedy:!0},{pattern:/(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,lookbehind:!0,greedy:!0}],number:/\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,operator:/\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/}),delete n.languages.kotlin["class-name"];var e={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:"punctuation"},expression:{pattern:/[\s\S]+/,inside:n.languages.kotlin}};n.languages.insertBefore("kotlin","string",{"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:"multiline",inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:e},string:/[\s\S]+/}},{pattern:/"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:"singleline",inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:e},string:/[\s\S]+/}}],char:{pattern:/'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,greedy:!0}}),delete n.languages.kotlin.string,n.languages.insertBefore("kotlin","keyword",{annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:"builtin"}}),n.languages.insertBefore("kotlin","function",{label:{pattern:/\b\w+@|@\w+\b/,alias:"symbol"}}),n.languages.kt=n.languages.kotlin,n.languages.kts=n.languages.kotlin}(Prism);
|
||||
Prism.languages.lua={comment:/^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m,string:{pattern:/(["'])(?:(?!\1)[^\\\r\n]|\\z(?:\r\n|\s)|\\(?:\r\n|[^z]))*\1|\[(=*)\[[\s\S]*?\]\2\]/,greedy:!0},number:/\b0x[a-f\d]+(?:\.[a-f\d]*)?(?:p[+-]?\d+)?\b|\b\d+(?:\.\B|(?:\.\d*)?(?:e[+-]?\d+)?\b)|\B\.\d+(?:e[+-]?\d+)?\b/i,keyword:/\b(?:and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,function:/(?!\d)\w+(?=\s*(?:[({]))/,operator:[/[-+*%^&|#]|\/\/?|<[<=]?|>[>=]?|[=~]=?/,{pattern:/(^|[^.])\.\.(?!\.)/,lookbehind:!0}],punctuation:/[\[\](){},;]|\.+|:+/};
|
||||
!function(e){function n(e,n){return"___"+e.toUpperCase()+n+"___"}Object.defineProperties(e.languages["markup-templating"]={},{buildPlaceholders:{value:function(t,a,r,o){if(t.language===a){var c=t.tokenStack=[];t.code=t.code.replace(r,(function(e){if("function"==typeof o&&!o(e))return e;for(var r,i=c.length;-1!==t.code.indexOf(r=n(a,i));)++i;return c[i]=e,r})),t.grammar=e.languages.markup}}},tokenizePlaceholders:{value:function(t,a){if(t.language===a&&t.tokenStack){t.grammar=e.languages[a];var r=0,o=Object.keys(t.tokenStack);!function c(i){for(var u=0;u<i.length&&!(r>=o.length);u++){var g=i[u];if("string"==typeof g||g.content&&"string"==typeof g.content){var l=o[r],s=t.tokenStack[l],f="string"==typeof g?g:g.content,p=n(a,l),k=f.indexOf(p);if(k>-1){++r;var m=f.substring(0,k),d=new e.Token(a,e.tokenize(s,t.grammar),"language-"+a,s),h=f.substring(k+p.length),v=[];m&&v.push.apply(v,c([m])),v.push(d),h&&v.push.apply(v,c([h])),"string"==typeof g?i.splice.apply(i,[u,1].concat(v)):g.content=v}}else g.content&&c(g.content)}return i}(t.tokens)}}}})}(Prism);
|
||||
!function(e){var n=/\$(?:\w[a-z\d]*(?:_[^\x00-\x1F\s"'\\()$]*)?|\{[^}\s"'\\]+\})/i;e.languages.nginx={comment:{pattern:/(^|[\s{};])#.*/,lookbehind:!0,greedy:!0},directive:{pattern:/(^|\s)\w(?:[^;{}"'\\\s]|\\.|"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|\s+(?:#.*(?!.)|(?![#\s])))*?(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:{string:{pattern:/((?:^|[^\\])(?:\\\\)*)(?:"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/,lookbehind:!0,greedy:!0,inside:{escape:{pattern:/\\["'\\nrt]/,alias:"entity"},variable:n}},comment:{pattern:/(\s)#.*/,lookbehind:!0,greedy:!0},keyword:{pattern:/^\S+/,greedy:!0},boolean:{pattern:/(\s)(?:off|on)(?!\S)/,lookbehind:!0},number:{pattern:/(\s)\d+[a-z]*(?!\S)/i,lookbehind:!0},variable:n}},punctuation:/[{};]/}}(Prism);
|
||||
!function(e){var a=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,t=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],i=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,n=/<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,s=/[{}\[\](),:;]/;e.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:a,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:t,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:i,operator:n,punctuation:s};var l={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:e.languages.php},r=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:l}},{pLine truncated
|
||||
Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python;
|
||||
Prism.languages.verilog={comment:{pattern:/\/\/.*|\/\*[\s\S]*?\*\//,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"kernel-function":{pattern:/\B\$\w+\b/,alias:"property"},constant:/\B`\w+\b/,function:/\b\w+(?=\()/,keyword:/\b(?:alias|and|assert|assign|assume|automatic|before|begin|bind|bins|binsof|bit|break|buf|bufif0|bufif1|byte|case|casex|casez|cell|chandle|class|clocking|cmos|config|const|constraint|context|continue|cover|covergroup|coverpoint|cross|deassign|default|defparam|design|disable|dist|do|edge|else|end|endcase|endclass|endclocking|endconfig|endfunction|endgenerate|endgroup|endinterface|endmodule|endpackage|endprimitive|endprogram|endproperty|endsequence|endspecify|endtable|endtask|enum|event|expect|export|extends|extern|final|first_match|for|force|foreach|forever|fork|forkjoin|function|generate|genvar|highz0|highz1|if|iff|ifnone|ignore_bins|illegal_bins|import|incdir|include|initial|inout|input|inside|instance|int|integer|interface|intersect|join|join_any|join_none|large|liblist|library|local|localparam|logic|longint|macromodule|matches|medium|modport|module|nand|negedge|new|nmos|nor|noshowcancelled|not|notif0|notif1|null|or|output|package|packed|parameter|pmos|posedge|primitive|priority|program|property|protected|pull0|pull1|pulldown|pullup|pulsestyle_ondetect|pulsestyle_onevent|pure|rand|randc|randcase|randsequence|rcmos|real|realtime|ref|reg|release|repeat|return|rnmos|rpmos|rtran|rtranif0|rtranif1|scalared|sequence|shortint|shortreal|showcancelled|signed|small|solve|specify|specparam|static|string|strong0|strong1|struct|super|supply0|supply1|table|tagged|task|this|throughout|time|timeprecision|timeunit|tran|tranif0|tranif1|tri|tri0|tri1|triand|trior|trireg|type|typedef|union|unique|unsigned|use|uwire|var|vectored|virtual|void|wait|wait_order|wand|weak0|weak1|while|wildcard|wire|with|within|wor|xnor|xor)\b/,important:/\b(?:always|always_comb|always_ff|always_latch)\b(?: *@)?/,number:/\B##?\d+|(?:\b\d+)?'[odbh] ?[\da-fzx_?]+|\b(?:\d*[._])?\d+(?:e[-+]?\d+)?/i,operator:/[-+{}^~%*\/?=!<>&|]+/,punctuation:/[[\];(),.:]/};
|
||||
!function(e){var n=/[*&][^\s[\]{},]+/,r=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,t="(?:"+r.source+"(?:[ \t]+"+n.source+")?|"+n.source+"(?:[ \t]+"+r.source+")?)",a="(?:[^\\s\\x00-\\x08\\x0e-\\x1f!\"#%&'*,\\-:>?@[\\]`{|}\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*".replace(/<PLAIN>/g,(function(){return"[^\\s\\x00-\\x08\\x0e-\\x1f,[\\]{}\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff]"})),d="\"(?:[^\"\\\\\r\n]|\\\\.)*\"|'(?:[^'\\\\\r\n]|\\\\.)*'";function o(e,n){n=(n||"").replace(/m/g,"")+"m";var r="([:\\-,[{]\\s*(?:\\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\\]|\\}|(?:[\r\n]\\s*)?#))".replace(/<<prop>>/g,(function(){return t})).replace(/<<value>>/g,(function(){return e}));return RegExp(r,n)}e.languages.yaml={scalar:{pattern:RegExp("([\\-:]\\s*(?:\\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\\S[^\r\n]*(?:\\2[^\r\n]+)*)".replace(/<<prop>>/g,(function(){return t}))),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp("((?:^|[:\\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\\s*:\\s)".replace(/<<prop>>/g,(function(){return t})).replace(/<<key>>/g,(function(){return"(?:"+a+"|"+d+")"}))),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:o("\\d{4}-\\d\\d?-\\d\\d?(?:[tT]|[ \t]+)\\d\\d?:\\d{2}:\\d{2}(?:\\.\\d*)?(?:[ \t]*(?:Z|[-+]\\d\\d?(?::\\d{2})?))?|\\d{4}-\\d{2}-\\d{2}|\\d\\d?:\\d{2}(?::\\d{2}(?:\\.\\d*)?)?"),lookbehind:!0,alias:"number"},boolean:{pattern:o("false|true","i"),lookbehind:!0,alias:"important"},null:{pattern:o("null|~","i"),lookbehind:!0,alias:"important"},string:{pattern:o(d),lookbehind:!0,greedy:!0},number:{pattern:o("[+-]?(?:0x[\\da-f]+|0o[0-7]+|(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?|\\.inf|\\.nan)","i"),lookbehind:!0},tag:r,important:n,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(Prism);
|
||||
!function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document&&document.querySelector){var e,t="line-numbers",i="linkable-line-numbers",n=!0;Prism.plugins.lineHighlight={highlightLines:function(r,a,u){var c=(a="string"==typeof a?a:r.getAttribute("data-line")||"").replace(/\s+/g,"").split(",").filter(Boolean),d=+r.getAttribute("data-line-offset")||0,h=(function(){if(void 0===e){var t=document.createElement("div");t.style.fontSize="13px",t.style.lineHeight="1.5",t.style.padding="0",t.style.border="0",t.innerHTML=" <br /> ",document.body.appendChild(t),e=38===t.offsetHeight,document.body.removeChild(t)}return e}()?parseInt:parseFloat)(getComputedStyle(r).lineHeight),f=Prism.util.isActive(r,t),p=r.querySelector("code"),g=f?r:p||r,m=[],v=p&&g!=p?function(e,t){var i=getComputedStyle(e),n=getComputedStyle(t);function r(e){return+e.substr(0,e.length-2)}return t.offsetTop+r(n.borderTopWidth)+r(n.paddingTop)-r(i.paddingTop)}(r,p):0;c.forEach((function(e){var t=e.split("-"),i=+t[0],n=+t[1]||i,o=r.querySelector('.line-highlight[data-range="'+e+'"]')||document.createElement("div");if(m.push((function(){o.setAttribute("aria-hidden","true"),o.setAttribute("data-range",e),o.className=(u||"")+" line-highlight"})),f&&Prism.plugins.lineNumbers){var s=Prism.plugins.lineNumbers.getLine(r,i),l=Prism.plugins.lineNumbers.getLine(r,n);if(s){var a=s.offsetTop+v+"px";m.push((function(){o.style.top=a}))}if(l){var c=l.offsetTop-s.offsetTop+l.offsetHeight+"px";m.push((function(){o.style.height=c}))}}else m.push((function(){o.setAttribute("data-start",String(i)),n>i&&o.setAttribute("data-end",String(n)),o.style.top=(i-d-1)*h+v+"px",o.textContent=new Array(n-i+2).join(" \n")}));m.push((function(){o.style.width=r.scrollWidth+"px"})),m.push((function(){g.appendChild(o)}))}));var y=r.id;if(f&&Prism.util.isActive(r,i)&&y){s(r,i)||m.push((function(){r.classList.add(i)}));var b=parseInt(r.getAttribute("data-start")||"1");o(".line-numbers-rows > span",r).forEach((function(e,t){var i=t+b;e.onclick=function(){var e=y+"."+i;n=!1,location.hash=e,setTimeout((function(){n=!0}),1)}}))}return function(){m.forEach(l)}}};var r=0;Prism.hooks.add("before-sanity-check",(function(e){var t=e.element.parentElement;if(a(t)){var i=0;o(".line-highlight",t).forEach((function(e){i+=e.textContent.length,e.parentNode.removeChild(e)})),i&&/^(?: \n)+$/.test(e.code.slice(-i))&&(e.code=e.code.slice(0,-i))}})),Prism.hooks.add("complete",(function e(i){var n=i.element.parentElement;if(a(n)){clearTimeout(r);var o=Prism.plugins.lineNumbers,l=i.plugins&&i.plugins.lineNumbers;s(n,t)&&o&&!l?Prism.hooks.add("line-numbers",e):(Prism.plugins.lineHighlight.highlightLines(n)(),r=setTimeout(u,1))}})),window.addEventListener("hashchange",u),window.addEventListener("resize",(function(){o("pre").filter(a).map((function(e){return Prism.plugins.lineHighlight.highlightLines(e)})).forEach(l)}))}function o(e,t){return Array.prototype.slice.call((t||document).querySelectorAll(e))}function s(e,t){return e.classList.contains(t)}function l(e){e()}function a(e){return!!(e&&/pre/i.test(e.nodeName)&&(e.hasAttribute("data-line")||e.id&&Prism.util.isActive(e,i)))}function u(){var e=location.hash.slice(1);o(".temporary.line-highlight").forEach((function(e){e.parentNode.removeChild(e)}));var t=(e.match(/\.([\d,-]+)$/)||[,""])[1];if(t&&!document.getElementById(e)){var i=e.slice(0,e.lastIndexOf(".")),r=document.getElementById(i);r&&(r.hasAttribute("data-line")||r.setAttribute("data-line",""),Prism.plugins.lineHighlight.highlightLines(r,t,"temporary ")(),n&&document.querySelector(".temporary.line-highlight").scrollIntoView())}}}();
|
||||
!function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document){var e=[],t={},n=function(){};Prism.plugins.toolbar={};var a=Prism.plugins.toolbar.registerButton=function(n,a){var r;r="function"==typeof a?a:function(e){var t;return"function"==typeof a.onClick?((t=document.createElement("button")).type="button",t.addEventListener("click",(function(){a.onClick.call(this,e)}))):"string"==typeof a.url?(t=document.createElement("a")).href=a.url:t=document.createElement("span"),a.className&&t.classList.add(a.className),t.textContent=a.text,t},n in t?console.warn('There is a button with the key "'+n+'" registered already.'):e.push(t[n]=r)},r=Prism.plugins.toolbar.hook=function(a){var r=a.element.parentNode;if(r&&/pre/i.test(r.nodeName)&&!r.parentNode.classList.contains("code-toolbar")){var o=document.createElement("div");o.classList.add("code-toolbar"),r.parentNode.insertBefore(o,r),o.appendChild(r);var i=document.createElement("div");i.classList.add("toolbar");var l=e,d=function(e){for(;e;){var t=e.getAttribute("data-toolbar-order");if(null!=t)return(t=t.trim()).length?t.split(/\s*,\s*/g):[];e=e.parentElement}}(a.element);d&&(l=d.map((function(e){return t[e]||n}))),l.forEach((function(e){var t=e(a);if(t){var n=document.createElement("div");n.classList.add("toolbar-item"),n.appendChild(t),i.appendChild(n)}})),o.appendChild(i)}};a("label",(function(e){var t=e.element.parentNode;if(t&&/pre/i.test(t.nodeName)&&t.hasAttribute("data-label")){var n,a,r=t.getAttribute("data-label");try{a=document.querySelector("template#"+r)}catch(e){}return a?n=a.content:(t.hasAttribute("data-url")?(n=document.createElement("a")).href=t.getAttribute("data-url"):n=document.createElement("span"),n.textContent=r),n}})),Prism.hooks.add("complete",r)}}();
|
||||
!function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document)if(Prism.plugins.toolbar){var e={none:"Plain text",plain:"Plain text",plaintext:"Plain text",text:"Plain text",txt:"Plain text",html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",ssml:"SSML",rss:"RSS",css:"CSS",clike:"C-like",js:"JavaScript",abap:"ABAP",abnf:"ABNF",al:"AL",antlr4:"ANTLR4",g4:"ANTLR4",apacheconf:"Apache Configuration",apl:"APL",aql:"AQL",ino:"Arduino",arff:"ARFF",armasm:"ARM Assembly","arm-asm":"ARM Assembly",art:"Arturo",asciidoc:"AsciiDoc",adoc:"AsciiDoc",aspnet:"ASP.NET (C#)",asm6502:"6502 Assembly",asmatmel:"Atmel AVR Assembly",autohotkey:"AutoHotkey",autoit:"AutoIt",avisynth:"AviSynth",avs:"AviSynth","avro-idl":"Avro IDL",avdl:"Avro IDL",awk:"AWK",gawk:"GAWK",basic:"BASIC",bbcode:"BBcode",bnf:"BNF",rbnf:"RBNF",bsl:"BSL (1C:Enterprise)",oscript:"OneScript",csharp:"C#",cs:"C#",dotnet:"C#",cpp:"C++",cfscript:"CFScript",cfc:"CFScript",cil:"CIL",cmake:"CMake",cobol:"COBOL",coffee:"CoffeeScript",conc:"Concurnas",csp:"Content-Security-Policy","css-extras":"CSS Extras",csv:"CSV",cue:"CUE",dataweave:"DataWeave",dax:"DAX",django:"Django/Jinja2",jinja2:"Django/Jinja2","dns-zone-file":"DNS zone file","dns-zone":"DNS zone file",dockerfile:"Docker",dot:"DOT (Graphviz)",gv:"DOT (Graphviz)",ebnf:"EBNF",editorconfig:"EditorConfig",ejs:"EJS",etlua:"Embedded Lua templating",erb:"ERB","excel-formula":"Excel Formula",xlsx:"Excel Formula",xls:"Excel Formula",fsharp:"F#","firestore-security-rules":"Firestore security rules",ftl:"FreeMarker Template Language",gml:"GameMaker Language",gamemakerlanguage:"GameMaker Language",gap:"GAP (CAS)",gcode:"G-code",gdscript:"GDScript",gedcom:"GEDCOM",gettext:"gettext",po:"gettext",glsl:"GLSL",gn:"GN",gni:"GN","linker-script":"GNU Linker Script",ld:"GNU Linker Script","go-module":"Go module","go-mod":"Go module",graphql:"GraphQL",hbs:"Handlebars",hs:"Haskell",hcl:"HCL",hlsl:"HLSL",http:"HTTP",hpkp:"HTTP Public-Key-Pins",hsts:"HTTP Strict-Transport-Security",ichigojam:"IchigoJam","icu-message-format":"ICU Message Format",idr:"Idris",ignore:".ignore",gitignore:".gitignore",hgignore:".hgignore",npmignore:".npmignore",inform7:"Inform 7",javadoc:"JavaDoc",javadoclike:"JavaDoc-like",javastacktrace:"Java stack trace",jq:"JQ",jsdoc:"JSDoc","js-extras":"JS Extras",json:"JSON",webmanifest:"Web App Manifest",json5:"JSON5",jsonp:"JSONP",jsstacktrace:"JS stack trace","js-templates":"JS Templates",keepalived:"Keepalived Configure",kts:"Kotlin Script",kt:"Kotlin",kumir:"KuMir (КуМир)",kum:"KuMir (КуМир)",latex:"LaTeX",tex:"TeX",context:"ConTeXt",lilypond:"LilyPond",ly:"LilyPond",emacs:"Lisp",elisp:"Lisp","emacs-lisp":"Lisp",llvm:"LLVM IR",log:"Log file",lolcode:"LOLCODE",magma:"Magma (CAS)",md:"Markdown","markup-templating":"Markup templating",matlab:"MATLAB",maxscript:"MAXScript",mel:"MEL",metafont:"METAFONT",mongodb:"MongoDB",moon:"MoonScript",n1ql:"N1QL",n4js:"N4JS",n4jsd:"N4JS","nand2tetris-hdl":"Nand To Tetris HDL",naniscript:"Naninovel Script",nani:"Naninovel Script",nasm:"NASM",neon:"NEON",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",objc:"Objective-C",ocaml:"OCaml",opencl:"OpenCL",openqasm:"OpenQasm",qasm:"OpenQasm",parigp:"PARI/GP",objectpascal:"Object Pascal",psl:"PATROL Scripting Language",pcaxis:"PC-Axis",px:"PC-Axis",peoplecode:"PeopleCode",pcode:"PeopleCode",php:"PHP",phpdoc:"PHPDoc","php-extras":"PHP Extras","plant-uml":"PlantUML",plantuml:"PlantUML",plsql:"PL/SQL",powerquery:"PowerQuery",pq:"PowerQuery",mscript:"PowerQuery",powershell:"PowerShell",promql:"PromQL",properties:".properties",protobuf:"Protocol Buffers",purebasic:"PureBasic",pbfasm:"PureBasic",purs:"PureScript",py:"Python",qsharp:"Q#",qs:"Q#",q:"Q (kdb+ database)",qml:"QML",rkt:"Racket",cshtml:"Razor C#",razor:"Razor C#",jsx:"React JSX",tsx:"React TSX",renpy:"Ren'py",rpy:"Ren'py",res:"ReScript",rest:"reST (reStructuredText)",robotframework:"Robot Framework",robot:"Robot Framework",rb:"Ruby",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)","shell-session":"Shell session","sh-session":"Shell session",shellsession:"Shell session",sml:"SML",smlnj:"SML/NJ",solidity:"Solidity (Ethereum)",sol:"Solidity (Ethereum)","solution-file":"Solution file",sln:"Solution file",soy:"Soy (Closure Template)",sparql:"SPARQL",rq:"SPARQL","splunk-spl":"Splunk SPL",sqf:"SQF: Status Quo Function (Arma 3)",sql:"SQL",stata:"Stata Ado",iecst:"Structured Text (IEC 61131-3)",supercollider:"SuperCollider",sclang:"SuperCollider",systemd:"Systemd configuration file","t4-templating":"T4 templating","t4-cs":"T4 Text Templates (C#)",t4:"T4 Text Templates (C#)","t4-vb":"T4 Text Templates (VB)",tap:"TAP",tt2:"Template Toolkit 2",toml:"TOML",trickle:"trickle",troy:"troy",trig:"TriG",ts:"TypeScript",tsconfig:"TSConfig",uscript:"UnrealScript",uc:"UnrealScript",uorazor:"UO Razor Script",uri:"URI",url:"URL",vbnet:"VB.Net",vhdl:"VHDL",vim:"vim","visual-basic":"Visual Basic",vba:"VBA",vb:"Visual Basic",wasm:"WebAssembly","web-idl":"Web IDL",webidl:"Web IDL",wgsl:"WGSL",wiki:Line truncated
|
||||
!function(){function t(t){var e=document.createElement("textarea");e.value=t.getText(),e.style.top="0",e.style.left="0",e.style.position="fixed",document.body.appendChild(e),e.focus(),e.select();try{var o=document.execCommand("copy");setTimeout((function(){o?t.success():t.error()}),1)}catch(e){setTimeout((function(){t.error(e)}),1)}document.body.removeChild(e)}"undefined"!=typeof Prism&&"undefined"!=typeof document&&(Prism.plugins.toolbar?Prism.plugins.toolbar.registerButton("copy-to-clipboard",(function(e){var o=e.element,n=function(t){var e={copy:"Copy","copy-error":"Press Ctrl+C to copy","copy-success":"Copied!","copy-timeout":5e3};for(var o in e){for(var n="data-prismjs-"+o,c=t;c&&!c.hasAttribute(n);)c=c.parentElement;c&&(e[o]=c.getAttribute(n))}return e}(o),c=document.createElement("button");c.className="copy-to-clipboard-button",c.setAttribute("type","button");var r=document.createElement("span");return c.appendChild(r),u("copy"),function(e,o){e.addEventListener("click",(function(){!function(e){navigator.clipboard?navigator.clipboard.writeText(e.getText()).then(e.success,(function(){t(e)})):t(e)}(o)}))}(c,{getText:function(){return o.textContent},success:function(){u("copy-success"),i()},error:function(){u("copy-error"),setTimeout((function(){!function(t){window.getSelection().selectAllChildren(t)}(o)}),1),i()}}),c;function i(){setTimeout((function(){u("copy")}),n["copy-timeout"])}function u(t){r.textContent=n[t],c.setAttribute("data-copy-state",t)}})):console.warn("Copy to Clipboard plugin loaded before Toolbar plugin."))}();
|
||||
@@ -0,0 +1,15 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
func RunCmdByDir(dir string, cmdName string, arg ...string) (string, error) {
|
||||
cmd := exec.Command(cmdName, arg ...)
|
||||
cmd.Dir = dir
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(out), nil
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package utils_test
|
||||
|
||||
import (
|
||||
"blog/utils"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRunCmdByDir(t *testing.T) {
|
||||
_, err := utils.RunCmdByDir("./", "ping", "127.0.0.1")
|
||||
if err != nil {
|
||||
t.Error("run cmd error", err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
)
|
||||
|
||||
func IsDir(name string) bool {
|
||||
if info, err := os.Stat(name); err == nil {
|
||||
return info.IsDir()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
func IsFile(filename string) bool {
|
||||
existed := true
|
||||
if _, err := os.Stat(filename); os.IsNotExist(err) {
|
||||
existed = false
|
||||
}
|
||||
return existed
|
||||
}
|
||||
|
||||
func MakeDir(dir string) error {
|
||||
if !IsDir(dir) {
|
||||
return os.MkdirAll(dir, os.ModePerm)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func RemoveDir(dir string) error {
|
||||
|
||||
if !IsDir(dir) {
|
||||
return errors.New("cannot delete without directory")
|
||||
}
|
||||
|
||||
return os.RemoveAll(dir)
|
||||
}
|
||||
|
||||
func CopyFile(src, dst string) (int64, error) {
|
||||
sourceFileStat, err := os.Stat(src)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
if !sourceFileStat.Mode().IsRegular() {
|
||||
return 0, fmt.Errorf("%s is not a regular file", src)
|
||||
}
|
||||
|
||||
source, err := os.Open(src)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
defer source.Close()
|
||||
|
||||
destination, err := os.Create(dst)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
defer destination.Close()
|
||||
nBytes, err := io.Copy(destination, source)
|
||||
return nBytes, err
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
)
|
||||
|
||||
//通过git url 返回仓库的名字
|
||||
func GetRepoName(gitUrl string) (string, error) {
|
||||
|
||||
if !strings.HasSuffix(gitUrl, ".git") {
|
||||
return "", errors.New("git URL must end with .git!")
|
||||
}
|
||||
|
||||
noSuffixUrl := strings.TrimSuffix(gitUrl, ".git")
|
||||
urlArr := strings.Split(noSuffixUrl, "/")
|
||||
|
||||
return urlArr[ len(urlArr)-1 ], nil
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package utils_test
|
||||
|
||||
import (
|
||||
"blog/utils"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGetRepoName(t *testing.T) {
|
||||
url := "http://jsit205.vaiwan.cn/JiXieShi/blog.git"
|
||||
name, err := utils.GetRepoName(url)
|
||||
if err != nil || name != "blog" {
|
||||
t.Error("repository name error")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"fmt"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
const charset = "A0a12B3b4CDc56Ede7FGf8Hg9IhJKiLjkMNlmOPnQRopqrSstTuvUVwxWXyYzZ"
|
||||
|
||||
func generateCharset(url, hexMd5 string, len, sectionNum int, cb func(url, keyword string) bool) string {
|
||||
for i := 0; i < sectionNum; i++ {
|
||||
sectionHex := hexMd5[i*8 : 8+i*8]
|
||||
bits, _ := strconv.ParseUint(sectionHex, 16, 32)
|
||||
bits = bits & 0x3FFFFFFF
|
||||
keyword := ""
|
||||
for j := 0; j < len; j++ {
|
||||
idx := bits & 0x3D
|
||||
keyword = keyword + string(charset[idx])
|
||||
bits = bits >> 5
|
||||
}
|
||||
if cb(url, keyword) {
|
||||
return keyword
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// 起初生成6位的短码,当四组6位短码都重复时,再生成8位的短码,因此总共会有8个短码供你选择。
|
||||
|
||||
func GenerateShortUrl(url string, cb func(url, keyword string) bool) string {
|
||||
if url == "" || cb == nil {
|
||||
return ""
|
||||
}
|
||||
hexMd5 := fmt.Sprintf("%x", md5.Sum([]byte(url)))
|
||||
sections := len(hexMd5) / 8
|
||||
|
||||
keyword := generateCharset(url, hexMd5, 6, sections, cb)
|
||||
if keyword == "" {
|
||||
return generateCharset(url, hexMd5, 8, sections, cb)
|
||||
}
|
||||
return keyword
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package utils_test
|
||||
|
||||
import (
|
||||
"blog/utils"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGenerateShortUrl(t *testing.T) {
|
||||
url := "http://jsit205.vaiwan.cn/JiXieShi/blog.git"
|
||||
shortUrl := utils.GenerateShortUrl(url, func(url, keyword string) bool { return true })
|
||||
if shortUrl != "ItMIz7" {
|
||||
t.Error("generate short URL error")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
## config.json 配置说明
|
||||
|
||||
- "port": 服务器监听的端口号,
|
||||
- "pageSize": 首页每一页的文章数量,
|
||||
- "descriptionLen": 文章没有配置description字段时,默认取文章内容多少个字作为描述,
|
||||
- "author": 博客作者,网站底部展示,
|
||||
- "icp": 网站的备案号,
|
||||
- "webHookSecret": 博客文章更新勾子的密钥,这里要和你在仓库设置的密钥一样,
|
||||
- "categoryDisplayQuantity": 在分类页面下,每个分类下最多展示多少篇文章,
|
||||
- "utterancesRepo": 是否开启utterances评论,留空没有评论,否则填写评论存储的仓库name/repo,
|
||||
- "timeLayout": 解析时间的格式,保持和你文章里面的date字段一样,除非了解Golang的时间解析,否则不要修改,
|
||||
- "siteName": 网站的名字,
|
||||
- "documentGitUrl": 你文章的git地址,应用会把文章克隆在当前目录下,必须公开并且以.git结尾,
|
||||
- "htmlKeywords": 网页里面的htmlKeywords,
|
||||
- "htmlDescription": 网页里面的htmlDescription,
|
||||
- "themePath": 主题路径,留空使用/blog,
|
||||
- "themeColor": 博客的主题颜色,
|
||||
- "dashboardEntrance": 网站仪表盘的访问路径,留空使用/admin,
|
||||
- "themeOption": 网站可选择的主题颜色
|
||||
|
||||
|
||||
## MD 文章支持的字段
|
||||
|
||||
- "title": 文章标题,不填使用文件名,
|
||||
- "date": 文章日期,排序使用(导航文章使用这个来排序),
|
||||
- "description": 文章描述
|
||||
- "tags": 文章 tag
|
||||
- "author": 文章作者
|
||||
- "musicId": 网易云的歌单ID
|
||||
|
||||
> 文章的这些字段全部可以为空,但是没有日期会默认使用文件生成的日期,那样每次迁移文档时间都是不可控的。
|
||||
|
||||
## 其他
|
||||
开启utterances评论之后,utterancesRepo指向的仓库必须是公开并且可以被评论的,具体使用请访问 https://utteranc.es
|
||||
webHook的地址: 你的域名/api/git_push_hook
|
||||
Reference in new issue
Block a user